|
@@ -1,20 +1,31 @@
|
|
|
+[testenv="basic"]
|
|
|
[[keyword]]
|
|
|
-=== Keyword field type
|
|
|
+=== Keyword type family
|
|
|
++++
|
|
|
<titleabbrev>Keyword</titleabbrev>
|
|
|
++++
|
|
|
|
|
|
-A field to index structured content such as IDs, email addresses, hostnames,
|
|
|
-status codes, zip codes or tags.
|
|
|
+The keyword family includes the following field types:
|
|
|
+
|
|
|
+* <<keyword,`keyword`>>, which is used for structured content such as IDs, email
|
|
|
+addresses, hostnames, status codes, zip codes, or tags.
|
|
|
+* <<constant-keyword,`constant_keyword`>> for keyword fields that always contain
|
|
|
+the same value.
|
|
|
+* <<wildcard,`wildcard`>>, which optimizes log lines and similar keyword values
|
|
|
+for grep-like <<query-dsl-wildcard-query,wildcard queries>>.
|
|
|
|
|
|
-They are typically used for filtering (_Find me all blog posts where
|
|
|
-++status++ is ++published++_), for sorting, and for aggregations. Keyword
|
|
|
-fields are only searchable by their exact value.
|
|
|
+Keyword fields are often used in <<sort-search-results,sorting>>,
|
|
|
+<<search-aggregations,aggregations>>, and <<term-level-queries,term-level
|
|
|
+queries>>, such as <<query-dsl-term-query,`term`>>.
|
|
|
|
|
|
-If you need to index full text content such as email bodies or product
|
|
|
-descriptions, it is likely that you should rather use a <<text,`text`>> field.
|
|
|
+TIP: Avoid using keyword fields for full-text search. Use the <<text,`text`>>
|
|
|
+field type instead.
|
|
|
|
|
|
-Below is an example of a mapping for a keyword field:
|
|
|
+[discrete]
|
|
|
+[[keyword-field-type]]
|
|
|
+=== Keyword field type
|
|
|
+
|
|
|
+Below is an example of a mapping for a basic `keyword` field:
|
|
|
|
|
|
[source,console]
|
|
|
--------------------------------
|
|
@@ -36,8 +47,9 @@ PUT my-index-000001
|
|
|
include::numeric.asciidoc[tag=map-ids-as-keyword]
|
|
|
====
|
|
|
|
|
|
+[discrete]
|
|
|
[[keyword-params]]
|
|
|
-==== Parameters for keyword fields
|
|
|
+==== Parameters for basic keyword fields
|
|
|
|
|
|
The following parameters are accepted by `keyword` fields:
|
|
|
|
|
@@ -114,8 +126,6 @@ The following parameters are accepted by `keyword` fields:
|
|
|
|
|
|
Metadata about the field.
|
|
|
|
|
|
-NOTE: Indexes imported from 2.x do not support `keyword`. Instead they will
|
|
|
-attempt to downgrade `keyword` into `string`. This allows you to merge modern
|
|
|
-mappings with legacy mappings. Long lived indexes will have to be recreated
|
|
|
-before upgrading to 6.x but mapping downgrade gives you the opportunity to do
|
|
|
-the recreation on your own schedule.
|
|
|
+include::constant-keyword.asciidoc[]
|
|
|
+
|
|
|
+include::wildcard.asciidoc[]
|