diff --git a/docs/reference/mapping/params.asciidoc b/docs/reference/mapping/params.asciidoc index b0fcc53fe1c..51421afb494 100644 --- a/docs/reference/mapping/params.asciidoc +++ b/docs/reference/mapping/params.asciidoc @@ -22,6 +22,7 @@ The following mapping parameters are common to some or all field datatypes: * <> * <> * <> +* <> * <> * <> * <> @@ -66,6 +67,8 @@ include::params/index-options.asciidoc[] include::params/index-phrases.asciidoc[] +include::params/index-prefixes.asciidoc[] + include::params/multi-fields.asciidoc[] include::params/norms.asciidoc[] diff --git a/docs/reference/mapping/params/index-phrases.asciidoc b/docs/reference/mapping/params/index-phrases.asciidoc index f32cc7c988c..1b169a33dcc 100644 --- a/docs/reference/mapping/params/index-phrases.asciidoc +++ b/docs/reference/mapping/params/index-phrases.asciidoc @@ -1,5 +1,5 @@ [[index-phrases]] -=== Index Phrases +=== `index_phrases` If enabled, two-term word combinations ('shingles') are indexed into a separate field. This allows exact phrase queries (no slop) to run more efficiently, at the expense diff --git a/docs/reference/mapping/params/index-prefixes.asciidoc b/docs/reference/mapping/params/index-prefixes.asciidoc new file mode 100644 index 00000000000..203e063bbfb --- /dev/null +++ b/docs/reference/mapping/params/index-prefixes.asciidoc @@ -0,0 +1,62 @@ +[[index-prefixes]] +=== `index_prefixes` + +The `index_prefixes` parameter enables the indexing of term prefixes to speed +up prefix searches. It accepts the following optional settings: + +[horizontal] +`min_chars`:: + + The minimum prefix length to index. Must be greater than 0, and defaults + to 2. The value is inclusive. + +`max_chars`:: + + The maximum prefix length to index. Must be less than 20, and defaults to 5. + The value is inclusive. + +This example creates a text field using the default prefix length settings: + +[source,js] +-------------------------------- +PUT my_index +{ + "mappings": { + "_doc": { + "properties": { + "body_text": { + "type": "text", + "index_prefixes": { } <1> + } + } + } + } +} +-------------------------------- +// CONSOLE + +<1> An empty settings object will use the default `min_chars` and `max_chars` +settings + +This example uses custom prefix length settings: + +[source,js] +-------------------------------- +PUT my_index +{ + "mappings": { + "_doc": { + "properties": { + "full_name": { + "type": "text", + "index_prefixes": { + "min_chars" : 1, + "max_chars" : 10 + } + } + } + } + } +} +-------------------------------- +// CONSOLE \ No newline at end of file diff --git a/docs/reference/mapping/types/text.asciidoc b/docs/reference/mapping/types/text.asciidoc index f412db11848..dd7e6cbbacf 100644 --- a/docs/reference/mapping/types/text.asciidoc +++ b/docs/reference/mapping/types/text.asciidoc @@ -89,12 +89,11 @@ The following parameters are accepted by `text` fields: What information should be stored in the index, for search and highlighting purposes. Defaults to `positions`. -<>:: +<>:: If enabled, term prefixes of between 2 and 5 characters are indexed into a separate field. This allows prefix searches to run more efficiently, at - the expense of a larger index. Accepts an - <> + the expense of a larger index. <>:: @@ -142,33 +141,3 @@ The following parameters are accepted by `text` fields: Whether term vectors should be stored for an <> field. Defaults to `no`. - -[[index-prefix-config]] -==== Index Prefix configuration - -Text fields may also index term prefixes to speed up prefix searches. The `index_prefixes` -parameter is configured as below. Either or both of `min_chars` and `max_chars` may be excluded. -Both values are treated as inclusive - -[source,js] --------------------------------- -PUT my_index -{ - "mappings": { - "_doc": { - "properties": { - "full_name": { - "type": "text", - "index_prefixes" : { - "min_chars" : 1, <1> - "max_chars" : 10 <2> - } - } - } - } - } -} --------------------------------- -// CONSOLE -<1> `min_chars` must be greater than zero, defaults to 2 -<2> `max_chars` must be greater than or equal to `min_chars` and less than 20, defaults to 5 diff --git a/docs/reference/query-dsl/span-multi-term-query.asciidoc b/docs/reference/query-dsl/span-multi-term-query.asciidoc index de78d80284e..f79283b7fa4 100644 --- a/docs/reference/query-dsl/span-multi-term-query.asciidoc +++ b/docs/reference/query-dsl/span-multi-term-query.asciidoc @@ -40,6 +40,6 @@ GET /_search WARNING: `span_multi` queries will hit too many clauses failure if the number of terms that match the query exceeds the boolean query limit (defaults to 1024).To avoid an unbounded expansion you can set the <> of the multi term query to `top_terms_*` rewrite. Or, if you use `span_multi` on `prefix` query only, -you can activate the <> field option of the `text` field instead. This will +you can activate the <> field option of the `text` field instead. This will rewrite any prefix query on the field to a single term query that matches the indexed prefix.