Browse Source

[DOCS] Combine keyword family docs (#61662)

James Rodewig 5 years ago
parent
commit
5857c02b12

+ 0 - 4
docs/reference/mapping/types.asciidoc

@@ -176,7 +176,3 @@ include::types/text.asciidoc[]
 include::types/token-count.asciidoc[]
 
 include::types/shape.asciidoc[]
-
-include::types/constant-keyword.asciidoc[]
-
-include::types/wildcard.asciidoc[]

+ 3 - 4
docs/reference/mapping/types/constant-keyword.asciidoc

@@ -1,13 +1,11 @@
 [role="xpack"]
 [testenv="basic"]
 
+[discrete]
 [[constant-keyword]]
 === Constant keyword field type
-++++
-<titleabbrev>Constant keyword</titleabbrev>
-++++
 
-Constant keyword is a specialization of the <<keyword,`keyword`>> field for
+Constant keyword is a specialization of the `keyword` field for
 the case that all documents in the index have the same value.
 
 [source,console]
@@ -71,6 +69,7 @@ document), queries on the field will not match any documents. This includes
 
 The `value` of the field cannot be changed after it has been set.
 
+[discrete]
 [[constant-keyword-params]]
 ==== Parameters for constant keyword fields
 

+ 25 - 15
docs/reference/mapping/types/keyword.asciidoc

@@ -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[]

+ 3 - 3
docs/reference/mapping/types/wildcard.asciidoc

@@ -1,10 +1,8 @@
 [role="xpack"]
 [testenv="basic"]
+[discrete]
 [[wildcard]]
 === Wildcard field type
-++++
-<titleabbrev>Wildcard</titleabbrev>
-++++
 
 A `wildcard` field stores values optimised for wildcard grep-like queries.
 Wildcard queries are possible on other field types but suffer from constraints:
@@ -52,6 +50,7 @@ GET my-index-000001/_search
 --------------------------------------------------
 
 
+[discrete]
 [[wildcard-params]]
 ==== Parameters for wildcard fields
 
@@ -64,6 +63,7 @@ The following parameters are accepted by `wildcard` fields:
     Do not index any string longer than this value.  Defaults to `2147483647`
     so that all values would be accepted.
 
+[discrete]
 ==== Limitations
 
 * `wildcard` fields are untokenized like keyword fields, so do not support queries that rely on word positions such as phrase queries.