Skip to content

Commit 8613bde

Browse files
authored
[DOCS] Combine keyword family docs (#61662) (#61813)
1 parent 41613c1 commit 8613bde

12 files changed

+84
-69
lines changed

docs/reference/eql/eql-search-api.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Common Schema (ECS)]. If a data stream or index does not contain the
146146
`event.category` field, this value is required.
147147
+
148148
The event category field is typically mapped as a <<keyword,`keyword`>> or
149-
<<constant-keyword,constant keyword>> field.
149+
<<constant-keyword-field-type,constant keyword>> field.
150150

151151
`fetch_size`::
152152
(Optional, integer)

docs/reference/eql/eql.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ in the search request using the `timestamp_field` or `event_category_field`
390390
parameters.
391391

392392
The event category field is typically mapped as a <<keyword,`keyword`>> or
393-
<<constant-keyword,constant keyword>> field. The timestamp field is typically
393+
<<constant-keyword-field-type,constant keyword>> field. The timestamp field is typically
394394
mapped as a <<date,`date`>> or <<date_nanos,`date_nanos`>> field.
395395

396396
NOTE: You cannot use a <<nested,`nested`>> field or the sub-fields of a `nested`

docs/reference/eql/functions.asciidoc

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ If using a field as the argument, this parameter supports only the following
110110
field data types:
111111

112112
* <<keyword,`keyword`>>
113-
* <<constant-keyword,`constant_keyword`>>
113+
* <<constant-keyword-field-type,`constant_keyword`>>
114114
* <<text,`text`>> field with a <<keyword,`keyword`>> or
115-
<<constant-keyword,`constant_keyword`>> sub-field
115+
<<constant-keyword-field-type,`constant_keyword`>> sub-field
116116
--
117117

118118
`<left>`::
@@ -126,9 +126,9 @@ If using a field as the argument, this parameter supports only the following
126126
field data types:
127127

128128
* <<keyword,`keyword`>>
129-
* <<constant-keyword,`constant_keyword`>>
129+
* <<constant-keyword-field-type,`constant_keyword`>>
130130
* <<text,`text`>> field with a <<keyword,`keyword`>> or
131-
<<constant-keyword,`constant_keyword`>> sub-field
131+
<<constant-keyword-field-type,`constant_keyword`>> sub-field
132132
--
133133

134134
`<right>`::
@@ -142,9 +142,9 @@ If using a field as the argument, this parameter supports only the following
142142
field data types:
143143

144144
* <<keyword,`keyword`>>
145-
* <<constant-keyword,`constant_keyword`>>
145+
* <<constant-keyword-field-type,`constant_keyword`>>
146146
* <<text,`text`>> field with a <<keyword,`keyword`>> or
147-
<<constant-keyword,`constant_keyword`>> sub-field
147+
<<constant-keyword-field-type,`constant_keyword`>> sub-field
148148
--
149149

150150
`<greedy_matching>`::
@@ -400,9 +400,9 @@ If using a field as the argument, this parameter supports only the following
400400
field data types:
401401

402402
* <<keyword,`keyword`>>
403-
* <<constant-keyword,`constant_keyword`>>
403+
* <<constant-keyword-field-type,`constant_keyword`>>
404404
* <<text,`text`>> field with a <<keyword,`keyword`>> or
405-
<<constant-keyword,`constant_keyword`>> sub-field
405+
<<constant-keyword-field-type,`constant_keyword`>> sub-field
406406
--
407407

408408
`<substring>`::
@@ -415,9 +415,9 @@ If using a field as the argument, this parameter supports only the following
415415
field data types:
416416

417417
* <<keyword,`keyword`>>
418-
* <<constant-keyword,`constant_keyword`>>
418+
* <<constant-keyword-field-type,`constant_keyword`>>
419419
* <<text,`text`>> field with a <<keyword,`keyword`>> or
420-
<<constant-keyword,`constant_keyword`>> sub-field
420+
<<constant-keyword-field-type,`constant_keyword`>> sub-field
421421
--
422422

423423
*Returns:* boolean or `null`
@@ -478,9 +478,9 @@ If using a field as the argument, this parameter supports only the following
478478
field data types:
479479

480480
* <<keyword,`keyword`>>
481-
* <<constant-keyword,`constant_keyword`>>
481+
* <<constant-keyword-field-type,`constant_keyword`>>
482482
* <<text,`text`>> field with a <<keyword,`keyword`>> or
483-
<<constant-keyword,`constant_keyword`>> sub-field
483+
<<constant-keyword-field-type,`constant_keyword`>> sub-field
484484
--
485485

486486
`<substring>`::
@@ -499,9 +499,9 @@ If using a field as the argument, this parameter supports only the following
499499
field data types:
500500

501501
* <<keyword,`keyword`>>
502-
* <<constant-keyword,`constant_keyword`>>
502+
* <<constant-keyword-field-type,`constant_keyword`>>
503503
* <<text,`text`>> field with a <<keyword,`keyword`>> or
504-
<<constant-keyword,`constant_keyword`>> sub-field
504+
<<constant-keyword-field-type,`constant_keyword`>> sub-field
505505
--
506506

507507
`<start_pos>`::
@@ -565,9 +565,9 @@ If using a field as the argument, this parameter supports only the following
565565
field data types:
566566

567567
* <<keyword,`keyword`>>
568-
* <<constant-keyword,`constant_keyword`>>
568+
* <<constant-keyword-field-type,`constant_keyword`>>
569569
* <<text,`text`>> field with a <<keyword,`keyword`>> or
570-
<<constant-keyword,`constant_keyword`>> sub-field
570+
<<constant-keyword-field-type,`constant_keyword`>> sub-field
571571
--
572572

573573
*Returns:* integer or `null`
@@ -615,9 +615,9 @@ If using a field as the argument, this parameter supports only the following
615615
field data types:
616616

617617
* <<keyword,`keyword`>>
618-
* <<constant-keyword,`constant_keyword`>>
618+
* <<constant-keyword-field-type,`constant_keyword`>>
619619
* <<text,`text`>> field with a <<keyword,`keyword`>> or
620-
<<constant-keyword,`constant_keyword`>> sub-field
620+
<<constant-keyword-field-type,`constant_keyword`>> sub-field
621621
--
622622

623623
`<reg_exp>`::
@@ -812,9 +812,9 @@ If using a field as the argument, this parameter supports only the following
812812
field data types:
813813

814814
* <<keyword,`keyword`>>
815-
* <<constant-keyword,`constant_keyword`>>
815+
* <<constant-keyword-field-type,`constant_keyword`>>
816816
* <<text,`text`>> field with a <<keyword,`keyword`>> or
817-
<<constant-keyword,`constant_keyword`>> sub-field
817+
<<constant-keyword-field-type,`constant_keyword`>> sub-field
818818

819819
If this argument is `null`, the function returns `null`.
820820
--
@@ -880,9 +880,9 @@ If using a field as the argument, this parameter supports only the following
880880
field data types:
881881

882882
* <<keyword,`keyword`>>
883-
* <<constant-keyword,`constant_keyword`>>
883+
* <<constant-keyword-field-type,`constant_keyword`>>
884884
* <<text,`text`>> field with a <<keyword,`keyword`>> or
885-
<<constant-keyword,`constant_keyword`>> sub-field
885+
<<constant-keyword-field-type,`constant_keyword`>> sub-field
886886
--
887887

888888
`<substring>`::
@@ -895,9 +895,9 @@ If using a field as the argument, this parameter supports only the following
895895
field data types:
896896

897897
* <<keyword,`keyword`>>
898-
* <<constant-keyword,`constant_keyword`>>
898+
* <<constant-keyword-field-type,`constant_keyword`>>
899899
* <<text,`text`>> field with a <<keyword,`keyword`>> or
900-
<<constant-keyword,`constant_keyword`>> sub-field
900+
<<constant-keyword-field-type,`constant_keyword`>> sub-field
901901
--
902902

903903
*Returns:* boolean or `null`
@@ -979,9 +979,9 @@ If using a field as the argument, this parameter supports only the following
979979
field data types:
980980

981981
* <<keyword,`keyword`>>
982-
* <<constant-keyword,`constant_keyword`>>
982+
* <<constant-keyword-field-type,`constant_keyword`>>
983983
* <<text,`text`>> field with a <<keyword,`keyword`>> or
984-
<<constant-keyword,`constant_keyword`>> sub-field
984+
<<constant-keyword-field-type,`constant_keyword`>> sub-field
985985

986986
`<substring>`::
987987
(Required, string or `null`)
@@ -991,9 +991,9 @@ If using a field as the argument, this parameter supports only the following
991991
field data types:
992992

993993
* <<keyword,`keyword`>>
994-
* <<constant-keyword,`constant_keyword`>>
994+
* <<constant-keyword-field-type,`constant_keyword`>>
995995
* <<text,`text`>> field with a <<keyword,`keyword`>> or
996-
<<constant-keyword,`constant_keyword`>> sub-field
996+
<<constant-keyword-field-type,`constant_keyword`>> sub-field
997997

998998
*Returns:* boolean or `null`
999999

@@ -1148,9 +1148,9 @@ If using a field as the argument, this parameter supports only the following
11481148
field data types:
11491149

11501150
* <<keyword,`keyword`>>
1151-
* <<constant-keyword,`constant_keyword`>>
1151+
* <<constant-keyword-field-type,`constant_keyword`>>
11521152
* <<text,`text`>> field with a <<keyword,`keyword`>> or
1153-
<<constant-keyword,`constant_keyword`>> sub-field
1153+
<<constant-keyword-field-type,`constant_keyword`>> sub-field
11541154
--
11551155

11561156
`<wildcard_exp>`::

docs/reference/how-to/search-speed.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ run prefix queries. If your use-case involves running lots of prefix queries,
423423
this can speed up queries significantly.
424424

425425
[[faster-filtering-with-constant-keyword]]
426-
=== Use <<constant-keyword,`constant_keyword`>> to speed up filtering
426+
=== Use <<constant-keyword-field-type,`constant_keyword`>> to speed up filtering
427427

428428
There is a general rule that the cost of a filter is mostly a function of the
429429
number of matched documents. Imagine that you have an index containing cycles.

docs/reference/mapping/types.asciidoc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ type: `boolean`.
2424
<<binary,`binary`>>:: Binary value encoded as a Base64 string.
2525
<<boolean,`boolean`>>:: `true` and `false` values.
2626
Keyword:: The keyword family, including <<keyword, `keyword`>>,
27-
<<constant-keyword,`constant_keyword`>>, and
28-
<<wildcard, `wildcard`>>.
27+
<<constant-keyword-field-type,`constant_keyword`>>, and
28+
<<wildcard-field-type, `wildcard`>>.
2929
<<number,Numbers>>:: Numeric types, such as `long` and `double`, used to
3030
express amounts.
3131
Dates:: Date types, including <<date,`date`>> and
@@ -178,7 +178,3 @@ include::types/text.asciidoc[]
178178
include::types/token-count.asciidoc[]
179179

180180
include::types/shape.asciidoc[]
181-
182-
include::types/constant-keyword.asciidoc[]
183-
184-
include::types/wildcard.asciidoc[]

docs/reference/mapping/types/constant-keyword.asciidoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
[role="xpack"]
22
[testenv="basic"]
33

4-
[[constant-keyword]]
4+
[discrete]
5+
[[constant-keyword-field-type]]
56
=== Constant keyword field type
6-
++++
7-
<titleabbrev>Constant keyword</titleabbrev>
8-
++++
97

10-
Constant keyword is a specialization of the <<keyword,`keyword`>> field for
8+
Constant keyword is a specialization of the `keyword` field for
119
the case that all documents in the index have the same value.
1210

1311
[source,console]
@@ -71,6 +69,7 @@ document), queries on the field will not match any documents. This includes
7169

7270
The `value` of the field cannot be changed after it has been set.
7371

72+
[discrete]
7473
[[constant-keyword-params]]
7574
==== Parameters for constant keyword fields
7675

docs/reference/mapping/types/keyword.asciidoc

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
1+
[testenv="basic"]
12
[[keyword]]
2-
=== Keyword field type
3+
=== Keyword type family
34
++++
45
<titleabbrev>Keyword</titleabbrev>
56
++++
67

7-
A field to index structured content such as IDs, email addresses, hostnames,
8-
status codes, zip codes or tags.
8+
The keyword family includes the following field types:
9+
10+
* <<keyword,`keyword`>>, which is used for structured content such as IDs, email
11+
addresses, hostnames, status codes, zip codes, or tags.
12+
* <<constant-keyword-field-type,`constant_keyword`>> for keyword fields that always contain
13+
the same value.
14+
* <<wildcard-field-type,`wildcard`>>, which optimizes log lines and similar keyword values
15+
for grep-like <<query-dsl-wildcard-query,wildcard queries>>.
916

10-
They are typically used for filtering (_Find me all blog posts where
11-
++status++ is ++published++_), for sorting, and for aggregations. Keyword
12-
fields are only searchable by their exact value.
17+
Keyword fields are often used in <<sort-search-results,sorting>>,
18+
<<search-aggregations,aggregations>>, and <<term-level-queries,term-level
19+
queries>>, such as <<query-dsl-term-query,`term`>>.
1320

14-
If you need to index full text content such as email bodies or product
15-
descriptions, it is likely that you should rather use a <<text,`text`>> field.
21+
TIP: Avoid using keyword fields for full-text search. Use the <<text,`text`>>
22+
field type instead.
1623

17-
Below is an example of a mapping for a keyword field:
24+
[discrete]
25+
[[keyword-field-type]]
26+
=== Keyword field type
27+
28+
Below is an example of a mapping for a basic `keyword` field:
1829

1930
[source,console]
2031
--------------------------------
@@ -36,8 +47,9 @@ PUT my-index-000001
3647
include::numeric.asciidoc[tag=map-ids-as-keyword]
3748
====
3849

50+
[discrete]
3951
[[keyword-params]]
40-
==== Parameters for keyword fields
52+
==== Parameters for basic keyword fields
4153

4254
The following parameters are accepted by `keyword` fields:
4355

@@ -119,8 +131,6 @@ The following parameters are accepted by `keyword` fields:
119131

120132
Metadata about the field.
121133

122-
NOTE: Indexes imported from 2.x do not support `keyword`. Instead they will
123-
attempt to downgrade `keyword` into `string`. This allows you to merge modern
124-
mappings with legacy mappings. Long lived indexes will have to be recreated
125-
before upgrading to 6.x but mapping downgrade gives you the opportunity to do
126-
the recreation on your own schedule.
134+
include::constant-keyword.asciidoc[]
135+
136+
include::wildcard.asciidoc[]

docs/reference/mapping/types/wildcard.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
[role="xpack"]
22
[testenv="basic"]
3-
[[wildcard]]
3+
[discrete]
4+
[[wildcard-field-type]]
45
=== Wildcard field type
5-
++++
6-
<titleabbrev>Wildcard</titleabbrev>
7-
++++
86

97
A `wildcard` field stores values optimised for wildcard grep-like queries.
108
Wildcard queries are possible on other field types but suffer from constraints:
@@ -52,6 +50,7 @@ GET my-index-000001/_search
5250
--------------------------------------------------
5351

5452

53+
[discrete]
5554
[[wildcard-params]]
5655
==== Parameters for wildcard fields
5756

@@ -64,6 +63,7 @@ The following parameters are accepted by `wildcard` fields:
6463
Do not index any string longer than this value. Defaults to `2147483647`
6564
so that all values would be accepted.
6665

66+
[discrete]
6767
==== Limitations
6868

6969
* `wildcard` fields are untokenized like keyword fields, so do not support queries that rely on word positions such as phrase queries.

docs/reference/query-dsl.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ the stability of the cluster. Those queries can be categorised as follows:
3333
* Queries that need to do linear scans to identify matches:
3434
** <<query-dsl-script-query, `script queries`>>
3535
* Queries that have a high up-front cost :
36-
** <<query-dsl-fuzzy-query,`fuzzy queries`>> (except on <<wildcard, `wildcard`>> fields)
37-
** <<query-dsl-regexp-query,`regexp queries`>> (except on <<wildcard, `wildcard`>> fields)
38-
** <<query-dsl-prefix-query,`prefix queries`>> (except on <<wildcard, `wildcard`>> fields or those without <<index-prefixes, `index_prefixes`>>)
39-
** <<query-dsl-wildcard-query, `wildcard queries`>> (except on <<wildcard, `wildcard`>> fields)
36+
** <<query-dsl-fuzzy-query,`fuzzy queries`>> (except on <<wildcard-field-type, `wildcard`>> fields)
37+
** <<query-dsl-regexp-query,`regexp queries`>> (except on <<wildcard-field-type, `wildcard`>> fields)
38+
** <<query-dsl-prefix-query,`prefix queries`>> (except on <<wildcard-field-type, `wildcard`>> fields or those without <<index-prefixes, `index_prefixes`>>)
39+
** <<query-dsl-wildcard-query, `wildcard queries`>> (except on <<wildcard-field-type, `wildcard`>> fields)
4040
** <<query-dsl-range-query, `range queries>> on <<text, `text`>> and <<keyword, `keyword`>> fields
4141
* <<joining-queries, `Joining queries`>>
4242
* Queries on <<prefix-trees, deprecated geo shapes>>

docs/reference/redirects.asciidoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,3 +1130,13 @@ See <<joining-queries-notes>>.
11301130
=== Percolate query notes
11311131

11321132
See <<percolate-query-notes>>.
1133+
1134+
[role="exclude",id="constant-keyword"]
1135+
=== Constant keyword field type
1136+
1137+
See <<constant-keyword-field-type>>.
1138+
1139+
[role="exclude",id="wildcard"]
1140+
=== Wildcard field type
1141+
1142+
See <<wildcard-field-type>>.

docs/reference/search/search-your-data/retrieve-selected-fields.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ Only leaf fields are returned -- `fields` does not allow for fetching entire
155155
objects.
156156

157157
The `fields` parameter handles field types like <<alias, field aliases>> and
158-
<<constant-keyword, `constant_keyword`>> whose values aren't always present in
158+
<<constant-keyword-field-type, `constant_keyword`>> whose values aren't always present in
159159
the `_source`. Other mapping options are also respected, including
160160
<<ignore-above, `ignore_above`>>, <<ignore-malformed, `ignore_malformed`>> and
161161
<<null-value, `null_value`>>.

docs/reference/sql/language/data-types.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ s|SQL precision
2424
| <<number, `half_float`>> | half_float | FLOAT | 3
2525
| <<number, `scaled_float`>> | scaled_float | DOUBLE | 15
2626
| <<keyword, `keyword`>> | keyword | VARCHAR | 32,766
27-
| <<constant-keyword, `constant_keyword`>> | constant_keyword| VARCHAR | 32,766
27+
| <<constant-keyword-field-type, `constant_keyword`>> | constant_keyword| VARCHAR | 32,766
2828
| <<text, `text`>> | text | VARCHAR | 2,147,483,647
2929
| <<binary, `binary`>> | binary | VARBINARY | 2,147,483,647
3030
| <<date, `date`>> | datetime | TIMESTAMP | 29

0 commit comments

Comments
 (0)