mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 09:28:55 -04:00
Restructure query-languages docs files for clarity (#124797)
In a few previous PR's we restructured the ES|QL docs to make it possible to generate them dynamically. This PR just moves a few files around to make the query languages docs easier to work with, and a little more organized like the ES|QL docs. A bit part of this was setting up redirects to the new locations, so other repo's could correctly link to the elasticsearch docs.
This commit is contained in:
parent
8c737fb235
commit
94cad286bc
188 changed files with 1021 additions and 969 deletions
43
docs/redirects.yml
Normal file
43
docs/redirects.yml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
redirects:
|
||||||
|
'reference/query-languages/query-dsl-intervals-query.md': 'reference/query-languages/query-dsl/query-dsl-intervals-query.md'
|
||||||
|
'reference/query-languages/query-dsl-script-score-query.md': 'reference/query-languages/query-dsl/query-dsl-script-score-query.md'
|
||||||
|
'reference/query-languages/query-dsl-range-query.md': 'reference/query-languages/query-dsl/query-dsl-range-query.md'
|
||||||
|
'reference/query-languages/term-level-queries.md': 'reference/query-languages/query-dsl/term-level-queries.md'
|
||||||
|
'reference/query-languages/query-dsl-term-query.md': 'reference/query-languages/query-dsl/query-dsl-term-query.md'
|
||||||
|
'reference/query-languages/query-dsl-multi-match-query.md': 'reference/query-languages/query-dsl/query-dsl-multi-match-query.md'
|
||||||
|
'reference/query-languages/query-dsl-query-string-query.md':
|
||||||
|
to: 'reference/query-languages/query-dsl/query-dsl-query-string-query.md'
|
||||||
|
anchors:
|
||||||
|
'_boosting': 'boosting'
|
||||||
|
'boosting': 'boosting'
|
||||||
|
'query-string-syntax': 'query-string-syntax'
|
||||||
|
'reference/query-languages/shape-queries.md': 'reference/query-languages/query-dsl/shape-queries.md'
|
||||||
|
'reference/query-languages/geo-queries.md': 'reference/query-languages/query-dsl/geo-queries.md'
|
||||||
|
'reference/query-languages/full-text-queries.md': 'reference/query-languages/query-dsl/full-text-queries.md'
|
||||||
|
'reference/query-languages/compound-queries.md': 'reference/query-languages/query-dsl/compound-queries.md'
|
||||||
|
'reference/query-languages/query-dsl-bool-query.md': 'reference/query-languages/query-dsl/query-dsl-bool-query.md'
|
||||||
|
'reference/query-languages/query-dsl-match-query.md': 'reference/query-languages/query-dsl/query-dsl-match-query.md'
|
||||||
|
'reference/query-languages/query-dsl-sparse-vector-query.md': 'reference/query-languages/query-dsl/query-dsl-sparse-vector-query.md'
|
||||||
|
'reference/query-languages/regexp-syntax.md': 'reference/query-languages/query-dsl/regexp-syntax.md'
|
||||||
|
'reference/query-languages/query-dsl-script-query.md': 'reference/query-languages/query-dsl/query-dsl-script-query.md'
|
||||||
|
'reference/query-languages/eql-syntax.md': 'reference/query-languages/eql/eql-syntax.md'
|
||||||
|
'reference/query-languages/query-dsl-terms-query.md': 'reference/query-languages/query-dsl/query-dsl-terms-query.md'
|
||||||
|
'reference/query-languages/query-dsl-shape-query.md': 'reference/query-languages/query-dsl/query-dsl-shape-query.md'
|
||||||
|
'reference/query-languages/query-dsl-geo-shape-query.md': 'reference/query-languages/query-dsl/query-dsl-geo-shape-query.md'
|
||||||
|
'reference/query-languages/query-dsl-match-all-query.md': 'reference/query-languages/query-dsl/query-dsl-match-all-query.md'
|
||||||
|
'reference/query-languages/query-dsl-exists-query.md': 'reference/query-languages/query-dsl/query-dsl-exists-query.md'
|
||||||
|
'reference/query-languages/query-dsl-minimum-should-match.md': 'reference/query-languages/query-dsl/query-dsl-minimum-should-match.md'
|
||||||
|
'reference/query-languages/query-dsl-rank-feature-query.md': 'reference/query-languages/query-dsl/query-dsl-rank-feature-query.md'
|
||||||
|
'reference/query-languages/query-dsl-match-query-phrase.md': 'reference/query-languages/query-dsl/query-dsl-match-query-phrase.md'
|
||||||
|
'reference/query-languages/query-dsl-constant-score-query.md': 'reference/query-languages/query-dsl/query-dsl-constant-score-query.md'
|
||||||
|
'reference/query-languages/query-dsl-percolate-query.md': 'reference/query-languages/query-dsl/query-dsl-percolate-query.md'
|
||||||
|
'reference/query-languages/joining-queries.md': 'reference/query-languages/query-dsl/joining-queries.md'
|
||||||
|
'reference/query-languages/query-dsl-wildcard-query.md': 'reference/query-languages/query-dsl/query-dsl-wildcard-query.md'
|
||||||
|
'reference/query-languages/query-dsl-prefix-query.md': 'reference/query-languages/query-dsl/query-dsl-prefix-query.md'
|
||||||
|
'reference/query-languages/query-dsl-regexp-query.md': 'reference/query-languages/query-dsl/query-dsl-regexp-query.md'
|
||||||
|
'reference/query-languages/query-dsl-fuzzy-query.md': 'reference/query-languages/query-dsl/query-dsl-fuzzy-query.md'
|
||||||
|
'reference/query-languages/query-dsl-dis-max-query.md': 'reference/query-languages/query-dsl/query-dsl-dis-max-query.md'
|
||||||
|
'reference/query-languages/query-dsl-geo-distance-query.md': 'reference/query-languages/query-dsl/query-dsl-geo-distance-query.md'
|
||||||
|
'reference/query-languages/query-dsl-function-score-query.md': 'reference/query-languages/query-dsl/query-dsl-function-score-query.md'
|
||||||
|
'reference/query-languages/query-dsl-knn-query.md': 'reference/query-languages/query-dsl/query-dsl-knn-query.md'
|
||||||
|
'reference/query-languages/query-dsl-text-expansion-query.md': 'reference/query-languages/query-dsl/query-dsl-text-expansion-query.md'
|
|
@ -64,7 +64,7 @@ Response:
|
||||||
```
|
```
|
||||||
|
|
||||||
::::{warning}
|
::::{warning}
|
||||||
If a format or date value is incomplete, the date range aggregation replaces any missing components with default values. See [Missing date components](/reference/query-languages/query-dsl-range-query.md#missing-date-components).
|
If a format or date value is incomplete, the date range aggregation replaces any missing components with default values. See [Missing date components](/reference/query-languages/query-dsl/query-dsl-range-query.md#missing-date-components).
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ Response:
|
||||||
|
|
||||||
## High-precision requests [_high_precision_requests]
|
## High-precision requests [_high_precision_requests]
|
||||||
|
|
||||||
When requesting detailed buckets (typically for displaying a "zoomed in" map) a filter like [geo_bounding_box](/reference/query-languages/query-dsl-geo-bounding-box-query.md) should be applied to narrow the subject area otherwise potentially millions of buckets will be created and returned.
|
When requesting detailed buckets (typically for displaying a "zoomed in" map) a filter like [geo_bounding_box](/reference/query-languages/query-dsl/query-dsl-geo-bounding-box-query.md) should be applied to narrow the subject area otherwise potentially millions of buckets will be created and returned.
|
||||||
|
|
||||||
$$$geohashgrid-aggregation-high-precision-example$$$
|
$$$geohashgrid-aggregation-high-precision-example$$$
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ var bbox = geohash.decode_bbox('u17');
|
||||||
|
|
||||||
## Requests with additional bounding box filtering [_requests_with_additional_bounding_box_filtering]
|
## Requests with additional bounding box filtering [_requests_with_additional_bounding_box_filtering]
|
||||||
|
|
||||||
The `geohash_grid` aggregation supports an optional `bounds` parameter that restricts the cells considered to those that intersects the bounds provided. The `bounds` parameter accepts the bounding box in all the same [accepted formats](/reference/query-languages/query-dsl-geo-bounding-box-query.md#query-dsl-geo-bounding-box-query-accepted-formats) of the bounds specified in the Geo Bounding Box Query. This bounding box can be used with or without an additional `geo_bounding_box` query filtering the points prior to aggregating. It is an independent bounding box that can intersect with, be equal to, or be disjoint to any additional `geo_bounding_box` queries defined in the context of the aggregation.
|
The `geohash_grid` aggregation supports an optional `bounds` parameter that restricts the cells considered to those that intersects the bounds provided. The `bounds` parameter accepts the bounding box in all the same [accepted formats](/reference/query-languages/query-dsl/query-dsl-geo-bounding-box-query.md#query-dsl-geo-bounding-box-query-accepted-formats) of the bounds specified in the Geo Bounding Box Query. This bounding box can be used with or without an additional `geo_bounding_box` query filtering the points prior to aggregating. It is an independent bounding box that can intersect with, be equal to, or be disjoint to any additional `geo_bounding_box` queries defined in the context of the aggregation.
|
||||||
|
|
||||||
$$$geohashgrid-aggregation-with-bounds$$$
|
$$$geohashgrid-aggregation-with-bounds$$$
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ Response:
|
||||||
|
|
||||||
## High-precision requests [geohexgrid-high-precision]
|
## High-precision requests [geohexgrid-high-precision]
|
||||||
|
|
||||||
When requesting detailed buckets (typically for displaying a "zoomed in" map), a filter like [geo_bounding_box](/reference/query-languages/query-dsl-geo-bounding-box-query.md) should be applied to narrow the subject area. Otherwise, potentially millions of buckets will be created and returned.
|
When requesting detailed buckets (typically for displaying a "zoomed in" map), a filter like [geo_bounding_box](/reference/query-languages/query-dsl/query-dsl-geo-bounding-box-query.md) should be applied to narrow the subject area. Otherwise, potentially millions of buckets will be created and returned.
|
||||||
|
|
||||||
$$$geohexgrid-high-precision-ex$$$
|
$$$geohexgrid-high-precision-ex$$$
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ Response:
|
||||||
|
|
||||||
## Requests with additional bounding box filtering [geohexgrid-addtl-bounding-box-filtering]
|
## Requests with additional bounding box filtering [geohexgrid-addtl-bounding-box-filtering]
|
||||||
|
|
||||||
The `geohex_grid` aggregation supports an optional `bounds` parameter that restricts the cells considered to those that intersect the provided bounds. The `bounds` parameter accepts the same [bounding box formats](/reference/query-languages/query-dsl-geo-bounding-box-query.md#query-dsl-geo-bounding-box-query-accepted-formats) as the geo-bounding box query. This bounding box can be used with or without an additional `geo_bounding_box` query for filtering the points prior to aggregating. It is an independent bounding box that can intersect with, be equal to, or be disjoint to any additional `geo_bounding_box` queries defined in the context of the aggregation.
|
The `geohex_grid` aggregation supports an optional `bounds` parameter that restricts the cells considered to those that intersect the provided bounds. The `bounds` parameter accepts the same [bounding box formats](/reference/query-languages/query-dsl/query-dsl-geo-bounding-box-query.md#query-dsl-geo-bounding-box-query-accepted-formats) as the geo-bounding box query. This bounding box can be used with or without an additional `geo_bounding_box` query for filtering the points prior to aggregating. It is an independent bounding box that can intersect with, be equal to, or be disjoint to any additional `geo_bounding_box` queries defined in the context of the aggregation.
|
||||||
|
|
||||||
$$$geohexgrid-aggregation-with-bounds$$$
|
$$$geohexgrid-aggregation-with-bounds$$$
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ precision
|
||||||
: (Optional, integer) Integer zoom of the key used to define cells/buckets in the results. Defaults to `6`. Values outside of [`0`,`15`] will be rejected.
|
: (Optional, integer) Integer zoom of the key used to define cells/buckets in the results. Defaults to `6`. Values outside of [`0`,`15`] will be rejected.
|
||||||
|
|
||||||
bounds
|
bounds
|
||||||
: (Optional, object) Bounding box used to filter the geo-points or geo-shapes in each bucket. Accepts the same bounding box formats as the [geo-bounding box query](/reference/query-languages/query-dsl-geo-bounding-box-query.md#query-dsl-geo-bounding-box-query-accepted-formats).
|
: (Optional, object) Bounding box used to filter the geo-points or geo-shapes in each bucket. Accepts the same bounding box formats as the [geo-bounding box query](/reference/query-languages/query-dsl/query-dsl-geo-bounding-box-query.md#query-dsl-geo-bounding-box-query-accepted-formats).
|
||||||
|
|
||||||
size
|
size
|
||||||
: (Optional, integer) Maximum number of buckets to return. Defaults to 10,000. When results are trimmed, buckets are prioritized based on the volume of documents they contain.
|
: (Optional, integer) Maximum number of buckets to return. Defaults to 10,000. When results are trimmed, buckets are prioritized based on the volume of documents they contain.
|
||||||
|
|
|
@ -93,7 +93,7 @@ Response:
|
||||||
|
|
||||||
## High-precision requests [geotilegrid-high-precision]
|
## High-precision requests [geotilegrid-high-precision]
|
||||||
|
|
||||||
When requesting detailed buckets (typically for displaying a "zoomed in" map), a filter like [geo_bounding_box](/reference/query-languages/query-dsl-geo-bounding-box-query.md) should be applied to narrow the subject area. Otherwise, potentially millions of buckets will be created and returned.
|
When requesting detailed buckets (typically for displaying a "zoomed in" map), a filter like [geo_bounding_box](/reference/query-languages/query-dsl/query-dsl-geo-bounding-box-query.md) should be applied to narrow the subject area. Otherwise, potentially millions of buckets will be created and returned.
|
||||||
|
|
||||||
$$$geotilegrid-high-precision-ex$$$
|
$$$geotilegrid-high-precision-ex$$$
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ Response:
|
||||||
|
|
||||||
## Requests with additional bounding box filtering [geotilegrid-addtl-bounding-box-filtering]
|
## Requests with additional bounding box filtering [geotilegrid-addtl-bounding-box-filtering]
|
||||||
|
|
||||||
The `geotile_grid` aggregation supports an optional `bounds` parameter that restricts the cells considered to those that intersect the provided bounds. The `bounds` parameter accepts the same [bounding box formats](/reference/query-languages/query-dsl-geo-bounding-box-query.md#query-dsl-geo-bounding-box-query-accepted-formats) as the geo-bounding box query. This bounding box can be used with or without an additional `geo_bounding_box` query for filtering the points prior to aggregating. It is an independent bounding box that can intersect with, be equal to, or be disjoint to any additional `geo_bounding_box` queries defined in the context of the aggregation.
|
The `geotile_grid` aggregation supports an optional `bounds` parameter that restricts the cells considered to those that intersect the provided bounds. The `bounds` parameter accepts the same [bounding box formats](/reference/query-languages/query-dsl/query-dsl-geo-bounding-box-query.md#query-dsl-geo-bounding-box-query-accepted-formats) as the geo-bounding box query. This bounding box can be used with or without an additional `geo_bounding_box` query for filtering the points prior to aggregating. It is an independent bounding box that can intersect with, be equal to, or be disjoint to any additional `geo_bounding_box` queries defined in the context of the aggregation.
|
||||||
|
|
||||||
$$$geotilegrid-aggregation-with-bounds$$$
|
$$$geotilegrid-aggregation-with-bounds$$$
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ precision
|
||||||
: (Optional, integer) Integer zoom of the key used to define cells/buckets in the results. Defaults to `7`. Values outside of [`0`,`29`] will be rejected.
|
: (Optional, integer) Integer zoom of the key used to define cells/buckets in the results. Defaults to `7`. Values outside of [`0`,`29`] will be rejected.
|
||||||
|
|
||||||
bounds
|
bounds
|
||||||
: (Optional, object) Bounding box used to filter the geo-points or geo-shapes in each bucket. Accepts the same bounding box formats as the [geo-bounding box query](/reference/query-languages/query-dsl-geo-bounding-box-query.md#query-dsl-geo-bounding-box-query-accepted-formats).
|
: (Optional, object) Bounding box used to filter the geo-points or geo-shapes in each bucket. Accepts the same bounding box formats as the [geo-bounding box query](/reference/query-languages/query-dsl/query-dsl-geo-bounding-box-query.md#query-dsl-geo-bounding-box-query-accepted-formats).
|
||||||
|
|
||||||
size
|
size
|
||||||
: (Optional, integer) Maximum number of buckets to return. Defaults to 10,000. When results are trimmed, buckets are prioritized based on the volume of documents they contain.
|
: (Optional, integer) Maximum number of buckets to return. Defaults to 10,000. When results are trimmed, buckets are prioritized based on the volume of documents they contain.
|
||||||
|
|
|
@ -196,7 +196,7 @@ GET /_search
|
||||||
|
|
||||||
In the above example, buckets will be created for all the tags that starts with `swi`, except those starting with `electro` (so the tag `swing` will be aggregated but not `electro_swing`). The `include` regular expression will determine what values are "allowed" to be aggregated, while the `exclude` determines the values that should not be aggregated. When both are defined, the `exclude` has precedence, meaning, the `include` is evaluated first and only then the `exclude`.
|
In the above example, buckets will be created for all the tags that starts with `swi`, except those starting with `electro` (so the tag `swing` will be aggregated but not `electro_swing`). The `include` regular expression will determine what values are "allowed" to be aggregated, while the `exclude` determines the values that should not be aggregated. When both are defined, the `exclude` has precedence, meaning, the `include` is evaluated first and only then the `exclude`.
|
||||||
|
|
||||||
The syntax is the same as [regexp queries](/reference/query-languages/regexp-syntax.md).
|
The syntax is the same as [regexp queries](/reference/query-languages/query-dsl/regexp-syntax.md).
|
||||||
|
|
||||||
|
|
||||||
### Filtering Values with exact values [_filtering_values_with_exact_values]
|
### Filtering Values with exact values [_filtering_values_with_exact_values]
|
||||||
|
|
|
@ -448,7 +448,7 @@ GET /_search
|
||||||
|
|
||||||
In the above example, buckets will be created for all the tags that has the word `sport` in them, except those starting with `water_` (so the tag `water_sports` will not be aggregated). The `include` regular expression will determine what values are "allowed" to be aggregated, while the `exclude` determines the values that should not be aggregated. When both are defined, the `exclude` has precedence, meaning, the `include` is evaluated first and only then the `exclude`.
|
In the above example, buckets will be created for all the tags that has the word `sport` in them, except those starting with `water_` (so the tag `water_sports` will not be aggregated). The `include` regular expression will determine what values are "allowed" to be aggregated, while the `exclude` determines the values that should not be aggregated. When both are defined, the `exclude` has precedence, meaning, the `include` is evaluated first and only then the `exclude`.
|
||||||
|
|
||||||
The syntax is the same as [regexp queries](/reference/query-languages/regexp-syntax.md).
|
The syntax is the same as [regexp queries](/reference/query-languages/query-dsl/regexp-syntax.md).
|
||||||
|
|
||||||
|
|
||||||
### Filtering Values with exact values [_filtering_values_with_exact_values_2]
|
### Filtering Values with exact values [_filtering_values_with_exact_values_2]
|
||||||
|
|
|
@ -29,7 +29,7 @@ The top_hits aggregation returns regular search hits, because of this many per h
|
||||||
|
|
||||||
* [Highlighting](/reference/elasticsearch/rest-apis/highlighting.md)
|
* [Highlighting](/reference/elasticsearch/rest-apis/highlighting.md)
|
||||||
* [Explain](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search)
|
* [Explain](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search)
|
||||||
* [Named queries](/reference/query-languages/query-dsl-bool-query.md#named-queries)
|
* [Named queries](/reference/query-languages/query-dsl/query-dsl-bool-query.md#named-queries)
|
||||||
* [Search fields](/reference/elasticsearch/rest-apis/retrieve-selected-fields.md#search-fields-param)
|
* [Search fields](/reference/elasticsearch/rest-apis/retrieve-selected-fields.md#search-fields-param)
|
||||||
* [Source filtering](/reference/elasticsearch/rest-apis/retrieve-selected-fields.md#source-filtering)
|
* [Source filtering](/reference/elasticsearch/rest-apis/retrieve-selected-fields.md#source-filtering)
|
||||||
* [Stored fields](/reference/elasticsearch/rest-apis/retrieve-selected-fields.md#stored-fields)
|
* [Stored fields](/reference/elasticsearch/rest-apis/retrieve-selected-fields.md#stored-fields)
|
||||||
|
@ -43,7 +43,7 @@ If you **only** need `docvalue_fields`, `size`, and `sort` then [Top metrics](/r
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
||||||
`top_hits` does not support the [`rescore`](/reference/elasticsearch/rest-apis/filter-search-results.md#rescore) parameter. Query rescoring applies only to search hits, not aggregation results. To change the scores used by aggregations, use a [`function_score`](/reference/query-languages/query-dsl-function-score-query.md) or [`script_score`](/reference/query-languages/query-dsl-script-score-query.md) query.
|
`top_hits` does not support the [`rescore`](/reference/elasticsearch/rest-apis/filter-search-results.md#rescore) parameter. Query rescoring applies only to search hits, not aggregation results. To change the scores used by aggregations, use a [`function_score`](/reference/query-languages/query-dsl/query-dsl-function-score-query.md) or [`script_score`](/reference/query-languages/query-dsl/query-dsl-script-score-query.md) query.
|
||||||
|
|
||||||
|
|
||||||
## Example [_example_6]
|
## Example [_example_6]
|
||||||
|
|
|
@ -12,7 +12,7 @@ Add shingles, or word [n-grams](https://en.wikipedia.org/wiki/N-gram), to a toke
|
||||||
For example, many tokenizers convert `the lazy dog` to `[ the, lazy, dog ]`. You can use the `shingle` filter to add two-word shingles to this stream: `[ the, the lazy, lazy, lazy dog, dog ]`.
|
For example, many tokenizers convert `the lazy dog` to `[ the, lazy, dog ]`. You can use the `shingle` filter to add two-word shingles to this stream: `[ the, the lazy, lazy, lazy dog, dog ]`.
|
||||||
|
|
||||||
::::{tip}
|
::::{tip}
|
||||||
Shingles are often used to help speed up phrase queries, such as [`match_phrase`](/reference/query-languages/query-dsl-match-query-phrase.md). Rather than creating shingles using the `shingles` filter, we recommend you use the [`index-phrases`](/reference/elasticsearch/mapping-reference/index-phrases.md) mapping parameter on the appropriate [text](/reference/elasticsearch/mapping-reference/text.md) field instead.
|
Shingles are often used to help speed up phrase queries, such as [`match_phrase`](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md). Rather than creating shingles using the `shingles` filter, we recommend you use the [`index-phrases`](/reference/elasticsearch/mapping-reference/index-phrases.md) mapping parameter on the appropriate [text](/reference/elasticsearch/mapping-reference/text.md) field instead.
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ The `simple_pattern` tokenizer uses a regular expression to capture matching tex
|
||||||
|
|
||||||
This tokenizer does not support splitting the input on a pattern match, unlike the [`pattern`](/reference/data-analysis/text-analysis/analysis-pattern-tokenizer.md) tokenizer. To split on pattern matches using the same restricted regular expression subset, see the [`simple_pattern_split`](/reference/data-analysis/text-analysis/analysis-simplepatternsplit-tokenizer.md) tokenizer.
|
This tokenizer does not support splitting the input on a pattern match, unlike the [`pattern`](/reference/data-analysis/text-analysis/analysis-pattern-tokenizer.md) tokenizer. To split on pattern matches using the same restricted regular expression subset, see the [`simple_pattern_split`](/reference/data-analysis/text-analysis/analysis-simplepatternsplit-tokenizer.md) tokenizer.
|
||||||
|
|
||||||
This tokenizer uses [Lucene regular expressions](https://lucene.apache.org/core/10_0_0/core/org/apache/lucene/util/automaton/RegExp.html). For an explanation of the supported features and syntax, see [Regular Expression Syntax](/reference/query-languages/regexp-syntax.md).
|
This tokenizer uses [Lucene regular expressions](https://lucene.apache.org/core/10_0_0/core/org/apache/lucene/util/automaton/RegExp.html). For an explanation of the supported features and syntax, see [Regular Expression Syntax](/reference/query-languages/query-dsl/regexp-syntax.md).
|
||||||
|
|
||||||
The default pattern is the empty string, which produces no terms. This tokenizer should always be configured with a non-default pattern.
|
The default pattern is the empty string, which produces no terms. This tokenizer should always be configured with a non-default pattern.
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ The `simple_pattern_split` tokenizer uses a regular expression to split the inpu
|
||||||
|
|
||||||
This tokenizer does not produce terms from the matches themselves. To produce terms from matches using patterns in the same restricted regular expression subset, see the [`simple_pattern`](/reference/data-analysis/text-analysis/analysis-simplepattern-tokenizer.md) tokenizer.
|
This tokenizer does not produce terms from the matches themselves. To produce terms from matches using patterns in the same restricted regular expression subset, see the [`simple_pattern`](/reference/data-analysis/text-analysis/analysis-simplepattern-tokenizer.md) tokenizer.
|
||||||
|
|
||||||
This tokenizer uses [Lucene regular expressions](https://lucene.apache.org/core/10_0_0/core/org/apache/lucene/util/automaton/RegExp.html). For an explanation of the supported features and syntax, see [Regular Expression Syntax](/reference/query-languages/regexp-syntax.md).
|
This tokenizer uses [Lucene regular expressions](https://lucene.apache.org/core/10_0_0/core/org/apache/lucene/util/automaton/RegExp.html). For an explanation of the supported features and syntax, see [Regular Expression Syntax](/reference/query-languages/query-dsl/regexp-syntax.md).
|
||||||
|
|
||||||
The default pattern is the empty string, which produces one term containing the full input. This tokenizer should always be configured with a non-default pattern.
|
The default pattern is the empty string, which produces one term containing the full input. This tokenizer should always be configured with a non-default pattern.
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ Setting this parameter to `true` produces multi-position tokens, which are not s
|
||||||
|
|
||||||
If this parameter is `true`, avoid using this filter in an index analyzer or use the [`flatten_graph`](/reference/data-analysis/text-analysis/analysis-flatten-graph-tokenfilter.md) filter after this filter to make the token stream suitable for indexing.
|
If this parameter is `true`, avoid using this filter in an index analyzer or use the [`flatten_graph`](/reference/data-analysis/text-analysis/analysis-flatten-graph-tokenfilter.md) filter after this filter to make the token stream suitable for indexing.
|
||||||
|
|
||||||
When used for search analysis, catenated tokens can cause problems for the [`match_phrase`](/reference/query-languages/query-dsl-match-query-phrase.md) query and other queries that rely on token position for matching. Avoid setting this parameter to `true` if you plan to use these queries.
|
When used for search analysis, catenated tokens can cause problems for the [`match_phrase`](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md) query and other queries that rely on token position for matching. Avoid setting this parameter to `true` if you plan to use these queries.
|
||||||
|
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ Setting this parameter to `true` produces multi-position tokens, which are not s
|
||||||
|
|
||||||
If this parameter is `true`, avoid using this filter in an index analyzer or use the [`flatten_graph`](/reference/data-analysis/text-analysis/analysis-flatten-graph-tokenfilter.md) filter after this filter to make the token stream suitable for indexing.
|
If this parameter is `true`, avoid using this filter in an index analyzer or use the [`flatten_graph`](/reference/data-analysis/text-analysis/analysis-flatten-graph-tokenfilter.md) filter after this filter to make the token stream suitable for indexing.
|
||||||
|
|
||||||
When used for search analysis, catenated tokens can cause problems for the [`match_phrase`](/reference/query-languages/query-dsl-match-query-phrase.md) query and other queries that rely on token position for matching. Avoid setting this parameter to `true` if you plan to use these queries.
|
When used for search analysis, catenated tokens can cause problems for the [`match_phrase`](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md) query and other queries that rely on token position for matching. Avoid setting this parameter to `true` if you plan to use these queries.
|
||||||
|
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ Setting this parameter to `true` produces multi-position tokens, which are not s
|
||||||
|
|
||||||
If this parameter is `true`, avoid using this filter in an index analyzer or use the [`flatten_graph`](/reference/data-analysis/text-analysis/analysis-flatten-graph-tokenfilter.md) filter after this filter to make the token stream suitable for indexing.
|
If this parameter is `true`, avoid using this filter in an index analyzer or use the [`flatten_graph`](/reference/data-analysis/text-analysis/analysis-flatten-graph-tokenfilter.md) filter after this filter to make the token stream suitable for indexing.
|
||||||
|
|
||||||
When used for search analysis, catenated tokens can cause problems for the [`match_phrase`](/reference/query-languages/query-dsl-match-query-phrase.md) query and other queries that rely on token position for matching. Avoid setting this parameter to `true` if you plan to use these queries.
|
When used for search analysis, catenated tokens can cause problems for the [`match_phrase`](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md) query and other queries that rely on token position for matching. Avoid setting this parameter to `true` if you plan to use these queries.
|
||||||
|
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ However, only the `word_delimiter_graph` filter assigns multi-position tokens a
|
||||||
|
|
||||||
The `word_delimiter` filter does not assign multi-position tokens a `positionLength` attribute. This means it produces invalid graphs for streams including these tokens.
|
The `word_delimiter` filter does not assign multi-position tokens a `positionLength` attribute. This means it produces invalid graphs for streams including these tokens.
|
||||||
|
|
||||||
While indexing does not support token graphs containing multi-position tokens, queries, such as the [`match_phrase`](/reference/query-languages/query-dsl-match-query-phrase.md) query, can use these graphs to generate multiple sub-queries from a single query string.
|
While indexing does not support token graphs containing multi-position tokens, queries, such as the [`match_phrase`](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md) query, can use these graphs to generate multiple sub-queries from a single query string.
|
||||||
|
|
||||||
To see how token graphs produced by the `word_delimiter` and `word_delimiter_graph` filters differ, check out the following example.
|
To see how token graphs produced by the `word_delimiter` and `word_delimiter_graph` filters differ, check out the following example.
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ Avoid using the `word_delimiter` filter with tokenizers that remove punctuation,
|
||||||
: (Optional, Boolean) If `true`, the filter produces catenated tokens for chains of alphanumeric characters separated by non-alphabetic delimiters. For example: `super-duper-xl-500` → [ `super`, **`superduperxl500`**, `duper`, `xl`, `500` ]. Defaults to `false`.
|
: (Optional, Boolean) If `true`, the filter produces catenated tokens for chains of alphanumeric characters separated by non-alphabetic delimiters. For example: `super-duper-xl-500` → [ `super`, **`superduperxl500`**, `duper`, `xl`, `500` ]. Defaults to `false`.
|
||||||
|
|
||||||
::::{warning}
|
::::{warning}
|
||||||
When used for search analysis, catenated tokens can cause problems for the [`match_phrase`](/reference/query-languages/query-dsl-match-query-phrase.md) query and other queries that rely on token position for matching. Avoid setting this parameter to `true` if you plan to use these queries.
|
When used for search analysis, catenated tokens can cause problems for the [`match_phrase`](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md) query and other queries that rely on token position for matching. Avoid setting this parameter to `true` if you plan to use these queries.
|
||||||
|
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ When used for search analysis, catenated tokens can cause problems for the [`mat
|
||||||
: (Optional, Boolean) If `true`, the filter produces catenated tokens for chains of numeric characters separated by non-alphabetic delimiters. For example: `01-02-03` → [ `01`, **`010203`**, `02`, `03` ]. Defaults to `false`.
|
: (Optional, Boolean) If `true`, the filter produces catenated tokens for chains of numeric characters separated by non-alphabetic delimiters. For example: `01-02-03` → [ `01`, **`010203`**, `02`, `03` ]. Defaults to `false`.
|
||||||
|
|
||||||
::::{warning}
|
::::{warning}
|
||||||
When used for search analysis, catenated tokens can cause problems for the [`match_phrase`](/reference/query-languages/query-dsl-match-query-phrase.md) query and other queries that rely on token position for matching. Avoid setting this parameter to `true` if you plan to use these queries.
|
When used for search analysis, catenated tokens can cause problems for the [`match_phrase`](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md) query and other queries that rely on token position for matching. Avoid setting this parameter to `true` if you plan to use these queries.
|
||||||
|
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ When used for search analysis, catenated tokens can cause problems for the [`mat
|
||||||
: (Optional, Boolean) If `true`, the filter produces catenated tokens for chains of alphabetical characters separated by non-alphabetic delimiters. For example: `super-duper-xl` → [ `super`, **`superduperxl`**, `duper`, `xl` ]. Defaults to `false`.
|
: (Optional, Boolean) If `true`, the filter produces catenated tokens for chains of alphabetical characters separated by non-alphabetic delimiters. For example: `super-duper-xl` → [ `super`, **`superduperxl`**, `duper`, `xl` ]. Defaults to `false`.
|
||||||
|
|
||||||
::::{warning}
|
::::{warning}
|
||||||
When used for search analysis, catenated tokens can cause problems for the [`match_phrase`](/reference/query-languages/query-dsl-match-query-phrase.md) query and other queries that rely on token position for matching. Avoid setting this parameter to `true` if you plan to use these queries.
|
When used for search analysis, catenated tokens can cause problems for the [`match_phrase`](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md) query and other queries that rely on token position for matching. Avoid setting this parameter to `true` if you plan to use these queries.
|
||||||
|
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ Will become:
|
||||||
```
|
```
|
||||||
|
|
||||||
::::{note}
|
::::{note}
|
||||||
Reordering text fields can have an effect on [phrase](/reference/query-languages/query-dsl-match-query-phrase.md) and [span](/reference/query-languages/span-queries.md) queries. See the discussion about [`position_increment_gap`](/reference/elasticsearch/mapping-reference/position-increment-gap.md) for more detail. You can avoid this by making sure the `slop` parameter on the phrase queries is lower than the `position_increment_gap`. This is the default.
|
Reordering text fields can have an effect on [phrase](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md) and [span](/reference/query-languages/query-dsl/span-queries.md) queries. See the discussion about [`position_increment_gap`](/reference/elasticsearch/mapping-reference/position-increment-gap.md) for more detail. You can avoid this by making sure the `slop` parameter on the phrase queries is lower than the `position_increment_gap`. This is the default.
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -115,9 +115,9 @@ $$$script-painless-regex-limit-factor$$$
|
||||||
|
|
||||||
## EQL circuit breaker [circuit-breakers-page-eql]
|
## EQL circuit breaker [circuit-breakers-page-eql]
|
||||||
|
|
||||||
When a [sequence](/reference/query-languages/eql-syntax.md#eql-sequences) query is executed, the node handling the query needs to keep some structures in memory, which are needed by the algorithm implementing the sequence matching. When large amounts of data need to be processed, and/or a large amount of matched sequences is requested by the user (by setting the [size](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-eql-search) query param), the memory occupied by those structures could potentially exceed the available memory of the JVM. This would cause an `OutOfMemory` exception which would bring down the node.
|
When a [sequence](/reference/query-languages/eql/eql-syntax.md#eql-sequences) query is executed, the node handling the query needs to keep some structures in memory, which are needed by the algorithm implementing the sequence matching. When large amounts of data need to be processed, and/or a large amount of matched sequences is requested by the user (by setting the [size](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-eql-search) query param), the memory occupied by those structures could potentially exceed the available memory of the JVM. This would cause an `OutOfMemory` exception which would bring down the node.
|
||||||
|
|
||||||
To prevent this from happening, a special circuit breaker is used, which limits the memory allocation during the execution of a [sequence](/reference/query-languages/eql-syntax.md#eql-sequences) query. When the breaker is triggered, an `org.elasticsearch.common.breaker.CircuitBreakingException` is thrown and a descriptive error message including `circuit_breaking_exception` is returned to the user.
|
To prevent this from happening, a special circuit breaker is used, which limits the memory allocation during the execution of a [sequence](/reference/query-languages/eql/eql-syntax.md#eql-sequences) query. When the breaker is triggered, an `org.elasticsearch.common.breaker.CircuitBreakingException` is thrown and a descriptive error message including `circuit_breaking_exception` is returned to the user.
|
||||||
|
|
||||||
This circuit breaker can be configured using the following settings:
|
This circuit breaker can be configured using the following settings:
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ $$$ccr-index-soft-deletes-retention-period$$$
|
||||||
: The maximum period to retain a shard history retention lease before it is considered expired. Shard history retention leases ensure that soft deletes are retained during merges on the Lucene index. If a soft delete is merged away before it can be replicated to a follower the following process will fail due to incomplete history on the leader. Defaults to `12h`.
|
: The maximum period to retain a shard history retention lease before it is considered expired. Shard history retention leases ensure that soft deletes are retained during merges on the Lucene index. If a soft delete is merged away before it can be replicated to a follower the following process will fail due to incomplete history on the leader. Defaults to `12h`.
|
||||||
|
|
||||||
$$$load-fixed-bitset-filters-eagerly$$$ `index.load_fixed_bitset_filters_eagerly`
|
$$$load-fixed-bitset-filters-eagerly$$$ `index.load_fixed_bitset_filters_eagerly`
|
||||||
: Indicates whether [cached filters](/reference/query-languages/query-filter-context.md) are pre-loaded for nested queries. Possible values are `true` (default) and `false`.
|
: Indicates whether [cached filters](/reference/query-languages/query-dsl/query-filter-context.md) are pre-loaded for nested queries. Possible values are `true` (default) and `false`.
|
||||||
|
|
||||||
$$$index-shard-check-on-startup$$$ `index.shard.check_on_startup`
|
$$$index-shard-check-on-startup$$$ `index.shard.check_on_startup`
|
||||||
: :::::{admonition}
|
: :::::{admonition}
|
||||||
|
@ -210,12 +210,12 @@ $$$index-query-default-field$$$
|
||||||
`index.query.default_field`
|
`index.query.default_field`
|
||||||
: (string or array of strings) Wildcard (`*`) patterns matching one or more fields. The following query types search these matching fields by default:
|
: (string or array of strings) Wildcard (`*`) patterns matching one or more fields. The following query types search these matching fields by default:
|
||||||
|
|
||||||
* [More like this](/reference/query-languages/query-dsl-mlt-query.md)
|
* [More like this](/reference/query-languages/query-dsl/query-dsl-mlt-query.md)
|
||||||
* [Multi-match](/reference/query-languages/query-dsl-multi-match-query.md)
|
* [Multi-match](/reference/query-languages/query-dsl/query-dsl-multi-match-query.md)
|
||||||
* [Query string](/reference/query-languages/query-dsl-query-string-query.md)
|
* [Query string](/reference/query-languages/query-dsl/query-dsl-query-string-query.md)
|
||||||
* [Simple query string](/reference/query-languages/query-dsl-simple-query-string-query.md)
|
* [Simple query string](/reference/query-languages/query-dsl/query-dsl-simple-query-string-query.md)
|
||||||
|
|
||||||
Defaults to `*`, which matches all fields eligible for [term-level queries](/reference/query-languages/term-level-queries.md), excluding metadata fields.
|
Defaults to `*`, which matches all fields eligible for [term-level queries](/reference/query-languages/query-dsl/term-level-queries.md), excluding metadata fields.
|
||||||
|
|
||||||
|
|
||||||
$$$index-routing-allocation-enable-setting$$$
|
$$$index-routing-allocation-enable-setting$$$
|
||||||
|
|
|
@ -67,10 +67,10 @@ Running any other aggregation on an `aggregate_metric_double` field will fail wi
|
||||||
|
|
||||||
Finally, an `aggregate_metric_double` field supports the following queries for which it behaves as a `double` by delegating its behavior to its `default_metric` sub-field:
|
Finally, an `aggregate_metric_double` field supports the following queries for which it behaves as a `double` by delegating its behavior to its `default_metric` sub-field:
|
||||||
|
|
||||||
* [`exists`](/reference/query-languages/query-dsl-exists-query.md)
|
* [`exists`](/reference/query-languages/query-dsl/query-dsl-exists-query.md)
|
||||||
* [`range`](/reference/query-languages/query-dsl-range-query.md)
|
* [`range`](/reference/query-languages/query-dsl/query-dsl-range-query.md)
|
||||||
* [`term`](/reference/query-languages/query-dsl-term-query.md)
|
* [`term`](/reference/query-languages/query-dsl/query-dsl-term-query.md)
|
||||||
* [`terms`](/reference/query-languages/query-dsl-terms-query.md)
|
* [`terms`](/reference/query-languages/query-dsl/query-dsl-terms-query.md)
|
||||||
|
|
||||||
|
|
||||||
## Examples [aggregate-metric-double-example]
|
## Examples [aggregate-metric-double-example]
|
||||||
|
|
|
@ -51,7 +51,7 @@ Unlike most other data types, dense vectors are always single-valued. It is not
|
||||||
|
|
||||||
A *k-nearest neighbor* (kNN) search finds the *k* nearest vectors to a query vector, as measured by a similarity metric.
|
A *k-nearest neighbor* (kNN) search finds the *k* nearest vectors to a query vector, as measured by a similarity metric.
|
||||||
|
|
||||||
Dense vector fields can be used to rank documents in [`script_score` queries](/reference/query-languages/query-dsl-script-score-query.md). This lets you perform a brute-force kNN search by scanning all documents and ranking them by similarity.
|
Dense vector fields can be used to rank documents in [`script_score` queries](/reference/query-languages/query-dsl/query-dsl-script-score-query.md). This lets you perform a brute-force kNN search by scanning all documents and ranking them by similarity.
|
||||||
|
|
||||||
In many cases, a brute-force kNN search is not efficient enough. For this reason, the `dense_vector` type supports indexing vectors into a specialized data structure to support fast kNN retrieval through the [`knn` option](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search) in the search API
|
In many cases, a brute-force kNN search is not efficient enough. For this reason, the `dense_vector` type supports indexing vectors into a specialized data structure to support fast kNN retrieval through the [`knn` option](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search) in the search API
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ $$$dense-vector-element-type$$$
|
||||||
: (Optional, integer) Number of vector dimensions. Can’t exceed `4096`. If `dims` is not specified, it will be set to the length of the first vector added to the field.
|
: (Optional, integer) Number of vector dimensions. Can’t exceed `4096`. If `dims` is not specified, it will be set to the length of the first vector added to the field.
|
||||||
|
|
||||||
`index`
|
`index`
|
||||||
: (Optional, Boolean) If `true`, you can search this field using the [knn query](/reference/query-languages/query-dsl-knn-query.md) or [knn in _search](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search) . Defaults to `true`.
|
: (Optional, Boolean) If `true`, you can search this field using the [knn query](/reference/query-languages/query-dsl/query-dsl-knn-query.md) or [knn in _search](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search) . Defaults to `true`.
|
||||||
|
|
||||||
$$$dense-vector-similarity$$$
|
$$$dense-vector-similarity$$$
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ The following mapping parameters are accepted:
|
||||||
: Which scoring algorithm or *similarity* should be used. Defaults to `BM25`.
|
: Which scoring algorithm or *similarity* should be used. Defaults to `BM25`.
|
||||||
|
|
||||||
`split_queries_on_whitespace`
|
`split_queries_on_whitespace`
|
||||||
: Whether [full text queries](/reference/query-languages/full-text-queries.md) should split the input on whitespace when building a query for this field. Accepts `true` or `false` (default).
|
: Whether [full text queries](/reference/query-languages/query-dsl/full-text-queries.md) should split the input on whitespace when building a query for this field. Accepts `true` or `false` (default).
|
||||||
|
|
||||||
`time_series_dimensions`
|
`time_series_dimensions`
|
||||||
: (Optional, array of strings) A list of fields inside the flattened object, where each field is a dimension of the time series. Each field is specified using the relative path from the root field and does not include the root field name.
|
: (Optional, array of strings) A list of fields inside the flattened object, where each field is a dimension of the time series. Each field is specified using the relative path from the root field and does not include the root field name.
|
||||||
|
|
|
@ -9,11 +9,11 @@ mapped_pages:
|
||||||
|
|
||||||
Fields of type `geo_point` accept latitude-longitude pairs, which can be used:
|
Fields of type `geo_point` accept latitude-longitude pairs, which can be used:
|
||||||
|
|
||||||
* to find geopoints within a [bounding box](/reference/query-languages/query-dsl-geo-bounding-box-query.md), within a certain [distance](/reference/query-languages/query-dsl-geo-distance-query.md) of a central point, or within a [`geo_shape` query](/reference/query-languages/query-dsl-geo-shape-query.md) (for example, points in a polygon).
|
* to find geopoints within a [bounding box](/reference/query-languages/query-dsl/query-dsl-geo-bounding-box-query.md), within a certain [distance](/reference/query-languages/query-dsl/query-dsl-geo-distance-query.md) of a central point, or within a [`geo_shape` query](/reference/query-languages/query-dsl/query-dsl-geo-shape-query.md) (for example, points in a polygon).
|
||||||
* to aggregate documents by [distance](/reference/data-analysis/aggregations/search-aggregations-bucket-geodistance-aggregation.md) from a central point.
|
* to aggregate documents by [distance](/reference/data-analysis/aggregations/search-aggregations-bucket-geodistance-aggregation.md) from a central point.
|
||||||
* to aggregate documents by geographic grids: either [`geo_hash`](/reference/data-analysis/aggregations/search-aggregations-bucket-geohashgrid-aggregation.md), [`geo_tile`](/reference/data-analysis/aggregations/search-aggregations-bucket-geotilegrid-aggregation.md) or [`geo_hex`](/reference/data-analysis/aggregations/search-aggregations-bucket-geohexgrid-aggregation.md).
|
* to aggregate documents by geographic grids: either [`geo_hash`](/reference/data-analysis/aggregations/search-aggregations-bucket-geohashgrid-aggregation.md), [`geo_tile`](/reference/data-analysis/aggregations/search-aggregations-bucket-geotilegrid-aggregation.md) or [`geo_hex`](/reference/data-analysis/aggregations/search-aggregations-bucket-geohexgrid-aggregation.md).
|
||||||
* to aggregate geopoints into a track using the metrics aggregation [`geo_line`](/reference/data-analysis/aggregations/search-aggregations-metrics-geo-line.md).
|
* to aggregate geopoints into a track using the metrics aggregation [`geo_line`](/reference/data-analysis/aggregations/search-aggregations-metrics-geo-line.md).
|
||||||
* to integrate distance into a document’s [relevance score](/reference/query-languages/query-dsl-function-score-query.md).
|
* to integrate distance into a document’s [relevance score](/reference/query-languages/query-dsl/query-dsl-function-score-query.md).
|
||||||
* to [sort](/reference/elasticsearch/rest-apis/sort-search-results.md#geo-sorting) documents by distance.
|
* to [sort](/reference/elasticsearch/rest-apis/sort-search-results.md#geo-sorting) documents by distance.
|
||||||
|
|
||||||
As with [geo_shape](/reference/elasticsearch/mapping-reference/geo-shape.md) and [point](/reference/elasticsearch/mapping-reference/point.md), `geo_point` can be specified in [GeoJSON](http://geojson.org) and [Well-Known Text](https://docs.opengeospatial.org/is/12-063r5/12-063r5.html) formats. However, there are a number of additional formats that are supported for convenience and historical reasons. In total there are six ways that a geopoint may be specified, as demonstrated below:
|
As with [geo_shape](/reference/elasticsearch/mapping-reference/geo-shape.md) and [point](/reference/elasticsearch/mapping-reference/point.md), `geo_point` can be specified in [GeoJSON](http://geojson.org) and [Well-Known Text](https://docs.opengeospatial.org/is/12-063r5/12-063r5.html) formats. However, there are a number of additional formats that are supported for convenience and historical reasons. In total there are six ways that a geopoint may be specified, as demonstrated below:
|
||||||
|
|
|
@ -13,9 +13,9 @@ Documents using this type can be used:
|
||||||
|
|
||||||
* to find geoshapes within:
|
* to find geoshapes within:
|
||||||
|
|
||||||
* a [bounding box](/reference/query-languages/query-dsl-geo-bounding-box-query.md)
|
* a [bounding box](/reference/query-languages/query-dsl/query-dsl-geo-bounding-box-query.md)
|
||||||
* a certain [distance](/reference/query-languages/query-dsl-geo-distance-query.md) of a central point
|
* a certain [distance](/reference/query-languages/query-dsl/query-dsl-geo-distance-query.md) of a central point
|
||||||
* a [`geo_shape` query](/reference/query-languages/query-dsl-geo-shape-query.md) (for example, intersecting polygons).
|
* a [`geo_shape` query](/reference/query-languages/query-dsl/query-dsl-geo-shape-query.md) (for example, intersecting polygons).
|
||||||
|
|
||||||
* to aggregate documents by geographic grids:
|
* to aggregate documents by geographic grids:
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ Because the data is not indexed, you only can use `histogram` fields for the fol
|
||||||
* [boxplot](/reference/data-analysis/aggregations/search-aggregations-metrics-boxplot-aggregation.md) aggregation
|
* [boxplot](/reference/data-analysis/aggregations/search-aggregations-metrics-boxplot-aggregation.md) aggregation
|
||||||
* [histogram](/reference/data-analysis/aggregations/search-aggregations-bucket-histogram-aggregation.md#search-aggregations-bucket-histogram-aggregation-histogram-fields) aggregation
|
* [histogram](/reference/data-analysis/aggregations/search-aggregations-bucket-histogram-aggregation.md#search-aggregations-bucket-histogram-aggregation-histogram-fields) aggregation
|
||||||
* [range](/reference/data-analysis/aggregations/search-aggregations-bucket-range-aggregation.md#search-aggregations-bucket-range-aggregation-histogram-fields) aggregation
|
* [range](/reference/data-analysis/aggregations/search-aggregations-bucket-range-aggregation.md#search-aggregations-bucket-range-aggregation-histogram-fields) aggregation
|
||||||
* [exists](/reference/query-languages/query-dsl-exists-query.md) query
|
* [exists](/reference/query-languages/query-dsl/query-dsl-exists-query.md) query
|
||||||
|
|
||||||
|
|
||||||
## Building a histogram [mapping-types-histogram-building-histogram]
|
## Building a histogram [mapping-types-histogram-building-histogram]
|
||||||
|
|
|
@ -16,7 +16,7 @@ The parameter accepts one of the following values. Each value retrieves informat
|
||||||
: Doc number and term frequencies are indexed. Term frequencies are used to score repeated terms higher than single terms.
|
: Doc number and term frequencies are indexed. Term frequencies are used to score repeated terms higher than single terms.
|
||||||
|
|
||||||
`positions` (default)
|
`positions` (default)
|
||||||
: Doc number, term frequencies, and term positions (or order) are indexed. Positions can be used for [proximity or phrase queries](/reference/query-languages/query-dsl-match-query-phrase.md).
|
: Doc number, term frequencies, and term positions (or order) are indexed. Positions can be used for [proximity or phrase queries](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md).
|
||||||
|
|
||||||
`offsets`
|
`offsets`
|
||||||
: Doc number, term frequencies, positions, and start and end character offsets (which map the term back to the original string) are indexed. Offsets are used by the [unified highlighter](/reference/elasticsearch/rest-apis/highlighting.md#unified-highlighter) to speed up highlighting.
|
: Doc number, term frequencies, positions, and start and end character offsets (which map the term back to the original string) are indexed. Offsets are used by the [unified highlighter](/reference/elasticsearch/rest-apis/highlighting.md#unified-highlighter) to speed up highlighting.
|
||||||
|
|
|
@ -107,7 +107,7 @@ GET my-index-000001/_search
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Also beware that colons are special characters to the [`query_string`](/reference/query-languages/query-dsl-query-string-query.md) query, so ipv6 addresses will need to be escaped. The easiest way to do so is to put quotes around the searched value:
|
Also beware that colons are special characters to the [`query_string`](/reference/query-languages/query-dsl/query-dsl-query-string-query.md) query, so ipv6 addresses will need to be escaped. The easiest way to do so is to put quotes around the searched value:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
GET my-index-000001/_search
|
GET my-index-000001/_search
|
||||||
|
|
|
@ -13,7 +13,7 @@ The keyword family includes the following field types:
|
||||||
* [`constant_keyword`](#constant-keyword-field-type) for keyword fields that always contain the same value.
|
* [`constant_keyword`](#constant-keyword-field-type) for keyword fields that always contain the same value.
|
||||||
* [`wildcard`](#wildcard-field-type) for unstructured machine-generated content. The `wildcard` type is optimized for fields with large values or high cardinality.
|
* [`wildcard`](#wildcard-field-type) for unstructured machine-generated content. The `wildcard` type is optimized for fields with large values or high cardinality.
|
||||||
|
|
||||||
Keyword fields are often used in [sorting](/reference/elasticsearch/rest-apis/sort-search-results.md), [aggregations](/reference/data-analysis/aggregations/index.md), and [term-level queries](/reference/query-languages/term-level-queries.md), such as [`term`](/reference/query-languages/query-dsl-term-query.md).
|
Keyword fields are often used in [sorting](/reference/elasticsearch/rest-apis/sort-search-results.md), [aggregations](/reference/data-analysis/aggregations/index.md), and [term-level queries](/reference/query-languages/query-dsl/term-level-queries.md), such as [`term`](/reference/query-languages/query-dsl/query-dsl-term-query.md).
|
||||||
|
|
||||||
::::{tip}
|
::::{tip}
|
||||||
Avoid using keyword fields for full-text search. Use the [`text`](/reference/elasticsearch/mapping-reference/text.md) field type instead.
|
Avoid using keyword fields for full-text search. Use the [`text`](/reference/elasticsearch/mapping-reference/text.md) field type instead.
|
||||||
|
@ -41,13 +41,13 @@ PUT my-index-000001
|
||||||
::::{admonition} Mapping numeric identifiers
|
::::{admonition} Mapping numeric identifiers
|
||||||
:class: tip
|
:class: tip
|
||||||
|
|
||||||
Not all numeric data should be mapped as a [numeric](/reference/elasticsearch/mapping-reference/number.md) field data type. {{es}} optimizes numeric fields, such as `integer` or `long`, for [`range`](/reference/query-languages/query-dsl-range-query.md) queries. However, `keyword` fields are better for [`term`](/reference/query-languages/query-dsl-term-query.md) and other [term-level](/reference/query-languages/term-level-queries.md) queries.
|
Not all numeric data should be mapped as a [numeric](/reference/elasticsearch/mapping-reference/number.md) field data type. {{es}} optimizes numeric fields, such as `integer` or `long`, for [`range`](/reference/query-languages/query-dsl/query-dsl-range-query.md) queries. However, `keyword` fields are better for [`term`](/reference/query-languages/query-dsl/query-dsl-term-query.md) and other [term-level](/reference/query-languages/query-dsl/term-level-queries.md) queries.
|
||||||
|
|
||||||
Identifiers, such as an ISBN or a product ID, are rarely used in `range` queries. However, they are often retrieved using term-level queries.
|
Identifiers, such as an ISBN or a product ID, are rarely used in `range` queries. However, they are often retrieved using term-level queries.
|
||||||
|
|
||||||
Consider mapping a numeric identifier as a `keyword` if:
|
Consider mapping a numeric identifier as a `keyword` if:
|
||||||
|
|
||||||
* You don’t plan to search for the identifier data using [`range`](/reference/query-languages/query-dsl-range-query.md) queries.
|
* You don’t plan to search for the identifier data using [`range`](/reference/query-languages/query-dsl/query-dsl-range-query.md) queries.
|
||||||
* Fast retrieval is important. `term` query searches on `keyword` fields are often faster than `term` searches on numeric fields.
|
* Fast retrieval is important. `term` query searches on `keyword` fields are often faster than `term` searches on numeric fields.
|
||||||
|
|
||||||
If you’re unsure which to use, you can use a [multi-field](/reference/elasticsearch/mapping-reference/multi-fields.md) to map the data as both a `keyword` *and* a numeric data type.
|
If you’re unsure which to use, you can use a [multi-field](/reference/elasticsearch/mapping-reference/multi-fields.md) to map the data as both a `keyword` *and* a numeric data type.
|
||||||
|
@ -103,7 +103,7 @@ The following parameters are accepted by `keyword` fields:
|
||||||
: How to pre-process the keyword prior to indexing. Defaults to `null`, meaning the keyword is kept as-is.
|
: How to pre-process the keyword prior to indexing. Defaults to `null`, meaning the keyword is kept as-is.
|
||||||
|
|
||||||
`split_queries_on_whitespace`
|
`split_queries_on_whitespace`
|
||||||
: Whether [full text queries](/reference/query-languages/full-text-queries.md) should split the input on whitespace when building a query for this field. Accepts `true` or `false` (default).
|
: Whether [full text queries](/reference/query-languages/query-dsl/full-text-queries.md) should split the input on whitespace when building a query for this field. Accepts `true` or `false` (default).
|
||||||
|
|
||||||
`time_series_dimension`
|
`time_series_dimension`
|
||||||
: (Optional, Boolean)
|
: (Optional, Boolean)
|
||||||
|
@ -283,7 +283,7 @@ However providing a value that is different from the one configured in the mappi
|
||||||
|
|
||||||
In case no `value` is provided in the mappings, the field will automatically configure itself based on the value contained in the first indexed document. While this behavior can be convenient, note that it means that a single poisonous document can cause all other documents to be rejected if it had a wrong value.
|
In case no `value` is provided in the mappings, the field will automatically configure itself based on the value contained in the first indexed document. While this behavior can be convenient, note that it means that a single poisonous document can cause all other documents to be rejected if it had a wrong value.
|
||||||
|
|
||||||
Before a value has been provided (either through the mappings or from a document), queries on the field will not match any documents. This includes [`exists`](/reference/query-languages/query-dsl-exists-query.md) queries.
|
Before a value has been provided (either through the mappings or from a document), queries on the field will not match any documents. This includes [`exists`](/reference/query-languages/query-dsl/query-dsl-exists-query.md) queries.
|
||||||
|
|
||||||
The `value` of the field cannot be changed after it has been set.
|
The `value` of the field cannot be changed after it has been set.
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ The following mapping parameters are accepted:
|
||||||
|
|
||||||
## Wildcard field type [wildcard-field-type]
|
## Wildcard field type [wildcard-field-type]
|
||||||
|
|
||||||
The `wildcard` field type is a specialized keyword field for unstructured machine-generated content you plan to search using grep-like [`wildcard`](/reference/query-languages/query-dsl-wildcard-query.md) and [`regexp`](/reference/query-languages/query-dsl-regexp-query.md) queries. The `wildcard` type is optimized for fields with large values or high cardinality.
|
The `wildcard` field type is a specialized keyword field for unstructured machine-generated content you plan to search using grep-like [`wildcard`](/reference/query-languages/query-dsl/query-dsl-wildcard-query.md) and [`regexp`](/reference/query-languages/query-dsl/query-dsl-regexp-query.md) queries. The `wildcard` type is optimized for fields with large values or high cardinality.
|
||||||
|
|
||||||
::::{admonition} Mapping unstructured content
|
::::{admonition} Mapping unstructured content
|
||||||
:name: mapping-unstructured-content
|
:name: mapping-unstructured-content
|
||||||
|
@ -311,16 +311,16 @@ You can map a field containing unstructured content to either a `text` or keywor
|
||||||
Use the `text` field type if:
|
Use the `text` field type if:
|
||||||
|
|
||||||
* The content is human-readable, such as an email body or product description.
|
* The content is human-readable, such as an email body or product description.
|
||||||
* You plan to search the field for individual words or phrases, such as `the brown fox jumped`, using [full text queries](/reference/query-languages/full-text-queries.md). {{es}} [analyzes](docs-content://manage-data/data-store/text-analysis.md) `text` fields to return the most relevant results for these queries.
|
* You plan to search the field for individual words or phrases, such as `the brown fox jumped`, using [full text queries](/reference/query-languages/query-dsl/full-text-queries.md). {{es}} [analyzes](docs-content://manage-data/data-store/text-analysis.md) `text` fields to return the most relevant results for these queries.
|
||||||
|
|
||||||
Use a keyword family field type if:
|
Use a keyword family field type if:
|
||||||
|
|
||||||
* The content is machine-generated, such as a log message or HTTP request information.
|
* The content is machine-generated, such as a log message or HTTP request information.
|
||||||
* You plan to search the field for exact full values, such as `org.foo.bar`, or partial character sequences, such as `org.foo.*`, using [term-level queries](/reference/query-languages/term-level-queries.md).
|
* You plan to search the field for exact full values, such as `org.foo.bar`, or partial character sequences, such as `org.foo.*`, using [term-level queries](/reference/query-languages/query-dsl/term-level-queries.md).
|
||||||
|
|
||||||
**Choosing a keyword family field type**
|
**Choosing a keyword family field type**
|
||||||
|
|
||||||
If you choose a keyword family field type, you can map the field as a `keyword` or `wildcard` field depending on the cardinality and size of the field’s values. Use the `wildcard` type if you plan to regularly search the field using a [`wildcard`](/reference/query-languages/query-dsl-wildcard-query.md) or [`regexp`](/reference/query-languages/query-dsl-regexp-query.md) query and meet one of the following criteria:
|
If you choose a keyword family field type, you can map the field as a `keyword` or `wildcard` field depending on the cardinality and size of the field’s values. Use the `wildcard` type if you plan to regularly search the field using a [`wildcard`](/reference/query-languages/query-dsl/query-dsl-wildcard-query.md) or [`regexp`](/reference/query-languages/query-dsl/query-dsl-regexp-query.md) query and meet one of the following criteria:
|
||||||
|
|
||||||
* The field contains more than a million unique values.<br> AND<br> You plan to regularly search the field using a pattern with leading wildcards, such as `*foo` or `*baz`.
|
* The field contains more than a million unique values.<br> AND<br> You plan to regularly search the field using a pattern with leading wildcards, such as `*foo` or `*baz`.
|
||||||
* The field contains values larger than 32KB.<br> AND<br> You plan to regularly search the field using any wildcard pattern.
|
* The field contains values larger than 32KB.<br> AND<br> You plan to regularly search the field using any wildcard pattern.
|
||||||
|
@ -329,7 +329,7 @@ Otherwise, use the `keyword` field type for faster searches, faster indexing, an
|
||||||
|
|
||||||
**Switching from a `text` field to a keyword field**
|
**Switching from a `text` field to a keyword field**
|
||||||
|
|
||||||
If you previously used a `text` field to index unstructured machine-generated content, you can [reindex to update the mapping](docs-content://manage-data/data-store/mapping/explicit-mapping.md#update-mapping) to a `keyword` or `wildcard` field. We also recommend you update your application or workflow to replace any word-based [full text queries](/reference/query-languages/full-text-queries.md) on the field to equivalent [term-level queries](/reference/query-languages/term-level-queries.md).
|
If you previously used a `text` field to index unstructured machine-generated content, you can [reindex to update the mapping](docs-content://manage-data/data-store/mapping/explicit-mapping.md#update-mapping) to a `keyword` or `wildcard` field. We also recommend you update your application or workflow to replace any word-based [full text queries](/reference/query-languages/query-dsl/full-text-queries.md) on the field to equivalent [term-level queries](/reference/query-languages/query-dsl/term-level-queries.md).
|
||||||
|
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@ mapped_pages:
|
||||||
|
|
||||||
# _field_names field [mapping-field-names-field]
|
# _field_names field [mapping-field-names-field]
|
||||||
|
|
||||||
The `_field_names` field used to index the names of every field in a document that contains any value other than `null`. This field was used by the [`exists`](/reference/query-languages/query-dsl-exists-query.md) query to find documents that either have or don’t have any non-`null` value for a particular field.
|
The `_field_names` field used to index the names of every field in a document that contains any value other than `null`. This field was used by the [`exists`](/reference/query-languages/query-dsl/query-dsl-exists-query.md) query to find documents that either have or don’t have any non-`null` value for a particular field.
|
||||||
|
|
||||||
Now the `_field_names` field only indexes the names of fields that have `doc_values` and `norms` disabled. For fields which have either `doc_values` or `norm` enabled the [`exists`](/reference/query-languages/query-dsl-exists-query.md) query will still be available but will not use the `_field_names` field.
|
Now the `_field_names` field only indexes the names of fields that have `doc_values` and `norms` disabled. For fields which have either `doc_values` or `norm` enabled the [`exists`](/reference/query-languages/query-dsl/query-dsl-exists-query.md) query will still be available but will not use the `_field_names` field.
|
||||||
|
|
||||||
## Disabling `_field_names` [disable-field-names]
|
## Disabling `_field_names` [disable-field-names]
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ mapped_pages:
|
||||||
|
|
||||||
# _id field [mapping-id-field]
|
# _id field [mapping-id-field]
|
||||||
|
|
||||||
Each document has an `_id` that uniquely identifies it, which is indexed so that documents can be looked up either with the [GET API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-get) or the [`ids` query](/reference/query-languages/query-dsl-ids-query.md). The `_id` can either be assigned at indexing time, or a unique `_id` can be generated by {{es}}. This field is not configurable in the mappings.
|
Each document has an `_id` that uniquely identifies it, which is indexed so that documents can be looked up either with the [GET API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-get) or the [`ids` query](/reference/query-languages/query-dsl/query-dsl-ids-query.md). The `_id` can either be assigned at indexing time, or a unique `_id` can be generated by {{es}}. This field is not configurable in the mappings.
|
||||||
|
|
||||||
The value of the `_id` field is accessible in queries such as `term`, `terms`, `match`, and `query_string`.
|
The value of the `_id` field is accessible in queries such as `term`, `terms`, `match`, and `query_string`.
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ GET my-index-000001/_search
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Querying on the `_id` field (also see the [`ids` query](/reference/query-languages/query-dsl-ids-query.md))
|
1. Querying on the `_id` field (also see the [`ids` query](/reference/query-languages/query-dsl/query-dsl-ids-query.md))
|
||||||
|
|
||||||
|
|
||||||
The `_id` field is restricted from use in aggregations, sorting, and scripting. In case sorting or aggregating on the `_id` field is required, it is advised to duplicate the content of the `_id` field into another field that has `doc_values` enabled.
|
The `_id` field is restricted from use in aggregations, sorting, and scripting. In case sorting or aggregating on the `_id` field is required, it is advised to duplicate the content of the `_id` field into another field that has `doc_values` enabled.
|
||||||
|
|
|
@ -7,7 +7,7 @@ mapped_pages:
|
||||||
|
|
||||||
The `_ignored` field indexes and stores the names of every field in a document that has been ignored when the document was indexed. This can, for example, be the case when the field was malformed and [`ignore_malformed`](/reference/elasticsearch/mapping-reference/ignore-malformed.md) was turned on, when a `keyword` field’s value exceeds its optional [`ignore_above`](/reference/elasticsearch/mapping-reference/ignore-above.md) setting, or when `index.mapping.total_fields.limit` has been reached and `index.mapping.total_fields.ignore_dynamic_beyond_limit` is set to `true`. For more index setting details, refer to [](/reference/elasticsearch/index-settings/mapping-limit.md).
|
The `_ignored` field indexes and stores the names of every field in a document that has been ignored when the document was indexed. This can, for example, be the case when the field was malformed and [`ignore_malformed`](/reference/elasticsearch/mapping-reference/ignore-malformed.md) was turned on, when a `keyword` field’s value exceeds its optional [`ignore_above`](/reference/elasticsearch/mapping-reference/ignore-above.md) setting, or when `index.mapping.total_fields.limit` has been reached and `index.mapping.total_fields.ignore_dynamic_beyond_limit` is set to `true`. For more index setting details, refer to [](/reference/elasticsearch/index-settings/mapping-limit.md).
|
||||||
|
|
||||||
This field is searchable with [`term`](/reference/query-languages/query-dsl-term-query.md), [`terms`](/reference/query-languages/query-dsl-terms-query.md) and [`exists`](/reference/query-languages/query-dsl-exists-query.md) queries, and is returned as part of the search hits.
|
This field is searchable with [`term`](/reference/query-languages/query-dsl/query-dsl-term-query.md), [`terms`](/reference/query-languages/query-dsl/query-dsl-terms-query.md) and [`exists`](/reference/query-languages/query-dsl/query-dsl-exists-query.md) queries, and is returned as part of the search hits.
|
||||||
|
|
||||||
For instance the below query matches all documents that have one or more fields that got ignored:
|
For instance the below query matches all documents that have one or more fields that got ignored:
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ GET my-index-000001/_search
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Querying on the `_routing` field (also see the [`ids` query](/reference/query-languages/query-dsl-ids-query.md))
|
1. Querying on the `_routing` field (also see the [`ids` query](/reference/query-languages/query-dsl/query-dsl-ids-query.md))
|
||||||
|
|
||||||
|
|
||||||
::::{note}
|
::::{note}
|
||||||
|
|
|
@ -74,7 +74,7 @@ GET my-index-000001/_search
|
||||||
|
|
||||||
If you need to index arrays of objects and to maintain the independence of each object in the array, use the `nested` data type instead of the [`object`](/reference/elasticsearch/mapping-reference/object.md) data type.
|
If you need to index arrays of objects and to maintain the independence of each object in the array, use the `nested` data type instead of the [`object`](/reference/elasticsearch/mapping-reference/object.md) data type.
|
||||||
|
|
||||||
Internally, nested objects index each object in the array as a separate hidden document, meaning that each nested object can be queried independently of the others with the [`nested` query](/reference/query-languages/query-dsl-nested-query.md):
|
Internally, nested objects index each object in the array as a separate hidden document, meaning that each nested object can be queried independently of the others with the [`nested` query](/reference/query-languages/query-dsl/query-dsl-nested-query.md):
|
||||||
|
|
||||||
```console
|
```console
|
||||||
PUT my-index-000001
|
PUT my-index-000001
|
||||||
|
@ -156,7 +156,7 @@ GET my-index-000001/_search
|
||||||
|
|
||||||
Nested documents can be:
|
Nested documents can be:
|
||||||
|
|
||||||
* queried with the [`nested`](/reference/query-languages/query-dsl-nested-query.md) query.
|
* queried with the [`nested`](/reference/query-languages/query-dsl/query-dsl-nested-query.md) query.
|
||||||
* analyzed with the [`nested`](/reference/data-analysis/aggregations/search-aggregations-bucket-nested-aggregation.md) and [`reverse_nested`](/reference/data-analysis/aggregations/search-aggregations-bucket-reverse-nested-aggregation.md) aggregations.
|
* analyzed with the [`nested`](/reference/data-analysis/aggregations/search-aggregations-bucket-nested-aggregation.md) and [`reverse_nested`](/reference/data-analysis/aggregations/search-aggregations-bucket-reverse-nested-aggregation.md) aggregations.
|
||||||
* sorted with [nested sorting](/reference/elasticsearch/rest-apis/sort-search-results.md#nested-sorting).
|
* sorted with [nested sorting](/reference/elasticsearch/rest-apis/sort-search-results.md#nested-sorting).
|
||||||
* retrieved and highlighted with [nested inner hits](/reference/elasticsearch/rest-apis/retrieve-inner-hits.md#nested-inner-hits).
|
* retrieved and highlighted with [nested inner hits](/reference/elasticsearch/rest-apis/retrieve-inner-hits.md#nested-inner-hits).
|
||||||
|
|
|
@ -7,7 +7,7 @@ mapped_pages:
|
||||||
|
|
||||||
The `normalizer` property of [`keyword`](/reference/elasticsearch/mapping-reference/keyword.md) fields is similar to [`analyzer`](/reference/elasticsearch/mapping-reference/analyzer.md) except that it guarantees that the analysis chain produces a single token.
|
The `normalizer` property of [`keyword`](/reference/elasticsearch/mapping-reference/keyword.md) fields is similar to [`analyzer`](/reference/elasticsearch/mapping-reference/analyzer.md) except that it guarantees that the analysis chain produces a single token.
|
||||||
|
|
||||||
The `normalizer` is applied prior to indexing the keyword, as well as at search-time when the `keyword` field is searched via a query parser such as the [`match`](/reference/query-languages/query-dsl-match-query.md) query or via a term-level query such as the [`term`](/reference/query-languages/query-dsl-term-query.md) query.
|
The `normalizer` is applied prior to indexing the keyword, as well as at search-time when the `keyword` field is searched via a query parser such as the [`match`](/reference/query-languages/query-dsl/query-dsl-match-query.md) query or via a term-level query such as the [`term`](/reference/query-languages/query-dsl/query-dsl-term-query.md) query.
|
||||||
|
|
||||||
A simple normalizer called `lowercase` ships with elasticsearch and can be used. Custom normalizers can be defined as part of analysis settings as follows.
|
A simple normalizer called `lowercase` ships with elasticsearch and can be used. Custom normalizers can be defined as part of analysis settings as follows.
|
||||||
|
|
||||||
|
|
|
@ -82,13 +82,13 @@ $$$floating_point$$$
|
||||||
::::{admonition} Mapping numeric identifiers
|
::::{admonition} Mapping numeric identifiers
|
||||||
:class: tip
|
:class: tip
|
||||||
|
|
||||||
Not all numeric data should be mapped as a `numeric` field data type. {{es}} optimizes numeric fields, such as `integer` or `long`, for [`range`](/reference/query-languages/query-dsl-range-query.md) queries. However, [`keyword`](/reference/elasticsearch/mapping-reference/keyword.md) fields are better for [`term`](/reference/query-languages/query-dsl-term-query.md) and other [term-level](/reference/query-languages/term-level-queries.md) queries.
|
Not all numeric data should be mapped as a `numeric` field data type. {{es}} optimizes numeric fields, such as `integer` or `long`, for [`range`](/reference/query-languages/query-dsl/query-dsl-range-query.md) queries. However, [`keyword`](/reference/elasticsearch/mapping-reference/keyword.md) fields are better for [`term`](/reference/query-languages/query-dsl/query-dsl-term-query.md) and other [term-level](/reference/query-languages/query-dsl/term-level-queries.md) queries.
|
||||||
|
|
||||||
Identifiers, such as an ISBN or a product ID, are rarely used in `range` queries. However, they are often retrieved using term-level queries.
|
Identifiers, such as an ISBN or a product ID, are rarely used in `range` queries. However, they are often retrieved using term-level queries.
|
||||||
|
|
||||||
Consider mapping a numeric identifier as a `keyword` if:
|
Consider mapping a numeric identifier as a `keyword` if:
|
||||||
|
|
||||||
* You don’t plan to search for the identifier data using [`range`](/reference/query-languages/query-dsl-range-query.md) queries.
|
* You don’t plan to search for the identifier data using [`range`](/reference/query-languages/query-dsl/query-dsl-range-query.md) queries.
|
||||||
* Fast retrieval is important. `term` query searches on `keyword` fields are often faster than `term` searches on numeric fields.
|
* Fast retrieval is important. `term` query searches on `keyword` fields are often faster than `term` searches on numeric fields.
|
||||||
|
|
||||||
If you’re unsure which to use, you can use a [multi-field](/reference/elasticsearch/mapping-reference/multi-fields.md) to map the data as both a `keyword` *and* a numeric data type.
|
If you’re unsure which to use, you can use a [multi-field](/reference/elasticsearch/mapping-reference/multi-fields.md) to map the data as both a `keyword` *and* a numeric data type.
|
||||||
|
@ -176,7 +176,7 @@ The following parameters are accepted by numeric types:
|
||||||
|
|
||||||
`scaled_float` is stored as a single `long` value, which is the product of multiplying the original value by the scaling factor. If the multiplication results in a value that is outside the range of a `long`, the value is saturated to the minimum or maximum value of a `long`. For example, if the scaling factor is `100` and the value is `92233720368547758.08`, the expected value is `9223372036854775808`. However, the value that is stored is `9223372036854775807`, the maximum value for a `long`.
|
`scaled_float` is stored as a single `long` value, which is the product of multiplying the original value by the scaling factor. If the multiplication results in a value that is outside the range of a `long`, the value is saturated to the minimum or maximum value of a `long`. For example, if the scaling factor is `100` and the value is `92233720368547758.08`, the expected value is `9223372036854775808`. However, the value that is stored is `9223372036854775807`, the maximum value for a `long`.
|
||||||
|
|
||||||
This can lead to unexpected results with [range queries](/reference/query-languages/query-dsl-range-query.md) when the scaling factor or provided `float` value are exceptionally large.
|
This can lead to unexpected results with [range queries](/reference/query-languages/query-dsl/query-dsl-range-query.md) when the scaling factor or provided `float` value are exceptionally large.
|
||||||
|
|
||||||
|
|
||||||
## Synthetic `_source` [numeric-synthetic-source]
|
## Synthetic `_source` [numeric-synthetic-source]
|
||||||
|
|
|
@ -243,9 +243,9 @@ Will return:
|
||||||
|
|
||||||
## Parent-join queries and aggregations [_parent_join_queries_and_aggregations]
|
## Parent-join queries and aggregations [_parent_join_queries_and_aggregations]
|
||||||
|
|
||||||
See the [`has_child`](/reference/query-languages/query-dsl-has-child-query.md) and [`has_parent`](/reference/query-languages/query-dsl-has-parent-query.md) queries, the [`children`](/reference/data-analysis/aggregations/search-aggregations-bucket-children-aggregation.md) aggregation, and [inner hits](/reference/elasticsearch/rest-apis/retrieve-inner-hits.md#parent-child-inner-hits) for more information.
|
See the [`has_child`](/reference/query-languages/query-dsl/query-dsl-has-child-query.md) and [`has_parent`](/reference/query-languages/query-dsl/query-dsl-has-parent-query.md) queries, the [`children`](/reference/data-analysis/aggregations/search-aggregations-bucket-children-aggregation.md) aggregation, and [inner hits](/reference/elasticsearch/rest-apis/retrieve-inner-hits.md#parent-child-inner-hits) for more information.
|
||||||
|
|
||||||
The value of the `join` field is accessible in aggregations and scripts, and may be queried with the [`parent_id` query](/reference/query-languages/query-dsl-parent-id-query.md):
|
The value of the `join` field is accessible in aggregations and scripts, and may be queried with the [`parent_id` query](/reference/query-languages/query-dsl/query-dsl-parent-id-query.md):
|
||||||
|
|
||||||
```console
|
```console
|
||||||
GET my-index-000001/_search
|
GET my-index-000001/_search
|
||||||
|
@ -278,7 +278,7 @@ GET my-index-000001/_search
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Querying the `parent id` field (also see the [`has_parent` query](/reference/query-languages/query-dsl-has-parent-query.md) and the [`has_child` query](/reference/query-languages/query-dsl-has-child-query.md))
|
1. Querying the `parent id` field (also see the [`has_parent` query](/reference/query-languages/query-dsl/query-dsl-has-parent-query.md) and the [`has_child` query](/reference/query-languages/query-dsl/query-dsl-has-child-query.md))
|
||||||
2. Aggregating on the `parent id` field (also see the [`children`](/reference/data-analysis/aggregations/search-aggregations-bucket-children-aggregation.md) aggregation)
|
2. Aggregating on the `parent id` field (also see the [`children`](/reference/data-analysis/aggregations/search-aggregations-bucket-children-aggregation.md) aggregation)
|
||||||
3. Accessing the `parent id` field in scripts.
|
3. Accessing the `parent id` field in scripts.
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ mapped_pages:
|
||||||
# Percolator field type [percolator]
|
# Percolator field type [percolator]
|
||||||
|
|
||||||
|
|
||||||
The `percolator` field type parses a json structure into a native query and stores that query, so that the [percolate query](/reference/query-languages/query-dsl-percolate-query.md) can use it to match provided documents.
|
The `percolator` field type parses a json structure into a native query and stores that query, so that the [percolate query](/reference/query-languages/query-dsl/query-dsl-percolate-query.md) can use it to match provided documents.
|
||||||
|
|
||||||
Any field that contains a json object can be configured to be a percolator field. The percolator field type has no settings. Just configuring the `percolator` field type is sufficient to instruct Elasticsearch to treat a field as a query.
|
Any field that contains a json object can be configured to be a percolator field. The percolator field type has no settings. Just configuring the `percolator` field type is sufficient to instruct Elasticsearch to treat a field as a query.
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ mapped_pages:
|
||||||
|
|
||||||
The `point` data type facilitates the indexing of and searching arbitrary `x, y` pairs that fall in a 2-dimensional planar coordinate system.
|
The `point` data type facilitates the indexing of and searching arbitrary `x, y` pairs that fall in a 2-dimensional planar coordinate system.
|
||||||
|
|
||||||
You can query documents using this type using [shape Query](/reference/query-languages/query-dsl-shape-query.md).
|
You can query documents using this type using [shape Query](/reference/query-languages/query-dsl/query-dsl-shape-query.md).
|
||||||
|
|
||||||
As with [geo_shape](/reference/elasticsearch/mapping-reference/geo-shape.md) and [geo_point](/reference/elasticsearch/mapping-reference/geo-point.md), `point` can be specified in [GeoJSON](http://geojson.org) and [Well-Known Text](https://docs.opengeospatial.org/is/12-063r5/12-063r5.html) formats. However, there are a number of additional formats that are supported for convenience and historical reasons. In total there are five ways that a cartesian point may be specified, as demonstrated below:
|
As with [geo_shape](/reference/elasticsearch/mapping-reference/geo-shape.md) and [geo_point](/reference/elasticsearch/mapping-reference/geo-point.md), `point` can be specified in [GeoJSON](http://geojson.org) and [Well-Known Text](https://docs.opengeospatial.org/is/12-063r5/12-063r5.html) formats. However, there are a number of additional formats that are supported for convenience and historical reasons. In total there are five ways that a cartesian point may be specified, as demonstrated below:
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ mapped_pages:
|
||||||
|
|
||||||
# position_increment_gap [position-increment-gap]
|
# position_increment_gap [position-increment-gap]
|
||||||
|
|
||||||
[Analyzed](/reference/elasticsearch/mapping-reference/mapping-index.md) text fields take term [positions](/reference/elasticsearch/mapping-reference/index-options.md) into account, in order to be able to support [proximity or phrase queries](/reference/query-languages/query-dsl-match-query-phrase.md). When indexing text fields with multiple values a "fake" gap is added between the values to prevent most phrase queries from matching across the values. The size of this gap is configured using `position_increment_gap` and defaults to `100`.
|
[Analyzed](/reference/elasticsearch/mapping-reference/mapping-index.md) text fields take term [positions](/reference/elasticsearch/mapping-reference/index-options.md) into account, in order to be able to support [proximity or phrase queries](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md). When indexing text fields with multiple values a "fake" gap is added between the values to prevent most phrase queries from matching across the values. The size of this gap is configured using `position_increment_gap` and defaults to `100`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ PUT range_index/_doc/1?refresh
|
||||||
3. Example date range using date time stamp.
|
3. Example date range using date time stamp.
|
||||||
|
|
||||||
|
|
||||||
The following is an example of a [term query](/reference/query-languages/query-dsl-term-query.md) on the `integer_range` field named "expected_attendees". 12 is a value inside the range, so it will match.
|
The following is an example of a [term query](/reference/query-languages/query-dsl/query-dsl-term-query.md) on the `integer_range` field named "expected_attendees". 12 is a value inside the range, so it will match.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
GET range_index/_search
|
GET range_index/_search
|
||||||
|
@ -137,7 +137,7 @@ GET range_index/_search
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Range queries work the same as described in [range query](/reference/query-languages/query-dsl-range-query.md).
|
1. Range queries work the same as described in [range query](/reference/query-languages/query-dsl/query-dsl-range-query.md).
|
||||||
2. Range queries over range [fields](/reference/elasticsearch/mapping-reference/field-data-types.md) support a `relation` parameter which can be one of `WITHIN`, `CONTAINS`, `INTERSECTS` (default).
|
2. Range queries over range [fields](/reference/elasticsearch/mapping-reference/field-data-types.md) support a `relation` parameter which can be one of `WITHIN`, `CONTAINS`, `INTERSECTS` (default).
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ mapped_pages:
|
||||||
# Rank feature field type [rank-feature]
|
# Rank feature field type [rank-feature]
|
||||||
|
|
||||||
|
|
||||||
A `rank_feature` field can index numbers so that they can later be used to boost documents in queries with a [`rank_feature`](/reference/query-languages/query-dsl-rank-feature-query.md) query.
|
A `rank_feature` field can index numbers so that they can later be used to boost documents in queries with a [`rank_feature`](/reference/query-languages/query-dsl/query-dsl-rank-feature-query.md) query.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
PUT my-index-000001
|
PUT my-index-000001
|
||||||
|
@ -51,7 +51,7 @@ GET my-index-000001/_search
|
||||||
|
|
||||||
|
|
||||||
::::{note}
|
::::{note}
|
||||||
`rank_feature` fields do not support querying, sorting or aggregating. They may only be used within [`rank_feature`](/reference/query-languages/query-dsl-rank-feature-query.md) queries.
|
`rank_feature` fields do not support querying, sorting or aggregating. They may only be used within [`rank_feature`](/reference/query-languages/query-dsl/query-dsl-rank-feature-query.md) queries.
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,5 +60,5 @@ GET my-index-000001/_search
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
||||||
Rank features that correlate negatively with the score should set `positive_score_impact` to `false` (defaults to `true`). This will be used by the [`rank_feature`](/reference/query-languages/query-dsl-rank-feature-query.md) query to modify the scoring formula in such a way that the score decreases with the value of the feature instead of increasing. For instance in web search, the url length is a commonly used feature which correlates negatively with scores.
|
Rank features that correlate negatively with the score should set `positive_score_impact` to `false` (defaults to `true`). This will be used by the [`rank_feature`](/reference/query-languages/query-dsl/query-dsl-rank-feature-query.md) query to modify the scoring formula in such a way that the score decreases with the value of the feature instead of increasing. For instance in web search, the url length is a commonly used feature which correlates negatively with scores.
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ mapped_pages:
|
||||||
# Rank features field type [rank-features]
|
# Rank features field type [rank-features]
|
||||||
|
|
||||||
|
|
||||||
A `rank_features` field can index numeric feature vectors, so that they can later be used to boost documents in queries with a [`rank_feature`](/reference/query-languages/query-dsl-rank-feature-query.md) query.
|
A `rank_features` field can index numeric feature vectors, so that they can later be used to boost documents in queries with a [`rank_feature`](/reference/query-languages/query-dsl/query-dsl-rank-feature-query.md) query.
|
||||||
|
|
||||||
It is analogous to the [`rank_feature`](/reference/elasticsearch/mapping-reference/rank-feature.md) data type but is better suited when the list of features is sparse so that it wouldn’t be reasonable to add one field to the mappings for each of them.
|
It is analogous to the [`rank_feature`](/reference/elasticsearch/mapping-reference/rank-feature.md) data type but is better suited when the list of features is sparse so that it wouldn’t be reasonable to add one field to the mappings for each of them.
|
||||||
|
|
||||||
|
@ -93,12 +93,12 @@ GET my-index-000001/_search
|
||||||
|
|
||||||
|
|
||||||
::::{note}
|
::::{note}
|
||||||
`rank_features` fields do not support sorting or aggregating and may only be queried using [`rank_feature`](/reference/query-languages/query-dsl-rank-feature-query.md) or [`term`](/reference/query-languages/query-dsl-term-query.md) queries.
|
`rank_features` fields do not support sorting or aggregating and may only be queried using [`rank_feature`](/reference/query-languages/query-dsl/query-dsl-rank-feature-query.md) or [`term`](/reference/query-languages/query-dsl/query-dsl-term-query.md) queries.
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
||||||
::::{note}
|
::::{note}
|
||||||
[`term`](/reference/query-languages/query-dsl-term-query.md) queries on `rank_features` fields are scored by multiplying the matched stored feature value by the provided `boost`.
|
[`term`](/reference/query-languages/query-dsl/query-dsl-term-query.md) queries on `rank_features` fields are scored by multiplying the matched stored feature value by the provided `boost`.
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,5 +107,5 @@ GET my-index-000001/_search
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
||||||
Rank features that correlate negatively with the score should set `positive_score_impact` to `false` (defaults to `true`). This will be used by the [`rank_feature`](/reference/query-languages/query-dsl-rank-feature-query.md) query to modify the scoring formula in such a way that the score decreases with the value of the feature instead of increasing.
|
Rank features that correlate negatively with the score should set `positive_score_impact` to `false` (defaults to `true`). This will be used by the [`rank_feature`](/reference/query-languages/query-dsl/query-dsl-rank-feature-query.md) query to modify the scoring formula in such a way that the score decreases with the value of the feature instead of increasing.
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ Synthetic `_source` is Generally Available only for TSDB indices (indices that h
|
||||||
|
|
||||||
## Scoring with rank vectors [rank-vectors-scoring]
|
## Scoring with rank vectors [rank-vectors-scoring]
|
||||||
|
|
||||||
Rank vectors can be accessed and used in [`script_score` queries](/reference/query-languages/query-dsl-script-score-query.md).
|
Rank vectors can be accessed and used in [`script_score` queries](/reference/query-languages/query-dsl/query-dsl-script-score-query.md).
|
||||||
|
|
||||||
For example, the following query scores documents based on the maxSim similarity between the query vector and the vectors stored in the `my_vector` field:
|
For example, the following query scores documents based on the maxSim similarity between the query vector and the vectors stored in the `my_vector` field:
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ PUT my-index-000001/_doc/1?refresh
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The most efficient way of querying to serve a search-as-you-type use case is usually a [`multi_match`](/reference/query-languages/query-dsl-multi-match-query.md) query of type [`bool_prefix`](/reference/query-languages/query-dsl-match-bool-prefix-query.md) that targets the root `search_as_you_type` field and its shingle subfields. This can match the query terms in any order, but will score documents higher if they contain the terms in order in a shingle subfield.
|
The most efficient way of querying to serve a search-as-you-type use case is usually a [`multi_match`](/reference/query-languages/query-dsl/query-dsl-multi-match-query.md) query of type [`bool_prefix`](/reference/query-languages/query-dsl/query-dsl-match-bool-prefix-query.md) that targets the root `search_as_you_type` field and its shingle subfields. This can match the query terms in any order, but will score documents higher if they contain the terms in order in a shingle subfield.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
GET my-index-000001/_search
|
GET my-index-000001/_search
|
||||||
|
@ -115,7 +115,7 @@ GET my-index-000001/_search
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
To search for documents that strictly match the query terms in order, or to search using other properties of phrase queries, use a [`match_phrase_prefix` query](/reference/query-languages/query-dsl-match-query-phrase-prefix.md) on the root field. A [`match_phrase` query](/reference/query-languages/query-dsl-match-query-phrase.md) can also be used if the last term should be matched exactly, and not as a prefix. Using phrase queries may be less efficient than using the `match_bool_prefix` query.
|
To search for documents that strictly match the query terms in order, or to search using other properties of phrase queries, use a [`match_phrase_prefix` query](/reference/query-languages/query-dsl/query-dsl-match-query-phrase-prefix.md) on the root field. A [`match_phrase` query](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md) can also be used if the last term should be matched exactly, and not as a prefix. Using phrase queries may be less efficient than using the `match_bool_prefix` query.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
GET my-index-000001/_search
|
GET my-index-000001/_search
|
||||||
|
@ -175,7 +175,7 @@ The following parameters are accepted in a mapping for the `search_as_you_type`
|
||||||
|
|
||||||
## Optimization of prefix queries [prefix-queries]
|
## Optimization of prefix queries [prefix-queries]
|
||||||
|
|
||||||
When making a [`prefix`](/reference/query-languages/query-dsl-prefix-query.md) query to the root field or any of its subfields, the query will be rewritten to a [`term`](/reference/query-languages/query-dsl-term-query.md) query on the `._index_prefix` subfield. This matches more efficiently than is typical of `prefix` queries on text fields, as prefixes up to a certain length of each shingle are indexed directly as terms in the `._index_prefix` subfield.
|
When making a [`prefix`](/reference/query-languages/query-dsl/query-dsl-prefix-query.md) query to the root field or any of its subfields, the query will be rewritten to a [`term`](/reference/query-languages/query-dsl/query-dsl-term-query.md) query on the `._index_prefix` subfield. This matches more efficiently than is typical of `prefix` queries on text fields, as prefixes up to a certain length of each shingle are indexed directly as terms in the `._index_prefix` subfield.
|
||||||
|
|
||||||
The analyzer of the `._index_prefix` subfield slightly modifies the shingle-building behavior to also index prefixes of the terms at the end of the field’s value that normally would not be produced as shingles. For example, if the value `quick brown fox` is indexed into a `search_as_you_type` field with `max_shingle_size` of 3, prefixes for `brown fox` and `fox` are also indexed into the `._index_prefix` subfield even though they do not appear as terms in the `._3gram` subfield. This allows for completion of all the terms in the field’s input.
|
The analyzer of the `._index_prefix` subfield slightly modifies the shingle-building behavior to also index prefixes of the terms at the end of the field’s value that normally would not be produced as shingles. For example, if the value `quick brown fox` is indexed into a `search_as_you_type` field with `max_shingle_size` of 3, prefixes for `brown fox` and `fox` are also indexed into the `._index_prefix` subfield even though they do not appear as terms in the `._3gram` subfield. This allows for completion of all the terms in the field’s input.
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ This functionality is in beta and is subject to change. The design and code is l
|
||||||
|
|
||||||
The `semantic_text` field type automatically generates embeddings for text content using an inference endpoint. Long passages are [automatically chunked](#auto-text-chunking) to smaller sections to enable the processing of larger corpuses of text.
|
The `semantic_text` field type automatically generates embeddings for text content using an inference endpoint. Long passages are [automatically chunked](#auto-text-chunking) to smaller sections to enable the processing of larger corpuses of text.
|
||||||
|
|
||||||
The `semantic_text` field type specifies an inference endpoint identifier that will be used to generate embeddings. You can create the inference endpoint by using the [Create {{infer}} API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put). This field type and the [`semantic` query](/reference/query-languages/query-dsl-semantic-query.md) type make it simpler to perform semantic search on your data. The `semantic_text` field type may also be queried with [match](/reference/query-languages/query-dsl-match-query.md), [sparse_vector](/reference/query-languages/query-dsl-sparse-vector-query.md) or [knn](/reference/query-languages/query-dsl-knn-query.md) queries.
|
The `semantic_text` field type specifies an inference endpoint identifier that will be used to generate embeddings. You can create the inference endpoint by using the [Create {{infer}} API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put). This field type and the [`semantic` query](/reference/query-languages/query-dsl/query-dsl-semantic-query.md) type make it simpler to perform semantic search on your data. The `semantic_text` field type may also be queried with [match](/reference/query-languages/query-dsl/query-dsl-match-query.md), [sparse_vector](/reference/query-languages/query-dsl/query-dsl-sparse-vector-query.md) or [knn](/reference/query-languages/query-dsl/query-dsl-knn-query.md) queries.
|
||||||
|
|
||||||
If you don’t specify an inference endpoint, the `inference_id` field defaults to `.elser-2-elasticsearch`, a preconfigured endpoint for the elasticsearch service.
|
If you don’t specify an inference endpoint, the `inference_id` field defaults to `.elser-2-elasticsearch`, a preconfigured endpoint for the elasticsearch service.
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ PUT test-index
|
||||||
|
|
||||||
`semantic_text` uses defaults for indexing data based on the {{infer}} endpoint specified. It enables you to quickstart your semantic search by providing automatic {{infer}} and a dedicated query so you don’t need to provide further details.
|
`semantic_text` uses defaults for indexing data based on the {{infer}} endpoint specified. It enables you to quickstart your semantic search by providing automatic {{infer}} and a dedicated query so you don’t need to provide further details.
|
||||||
|
|
||||||
In case you want to customize data indexing, use the [`sparse_vector`](/reference/elasticsearch/mapping-reference/sparse-vector.md) or [`dense_vector`](/reference/elasticsearch/mapping-reference/dense-vector.md) field types and create an ingest pipeline with an [{{infer}} processor](/reference/ingestion-tools/enrich-processor/inference-processor.md) to generate the embeddings. [This tutorial](docs-content://solutions/search/semantic-search/semantic-search-inference.md) walks you through the process. In these cases - when you use `sparse_vector` or `dense_vector` field types instead of the `semantic_text` field type to customize indexing - using the [`semantic_query`](/reference/query-languages/query-dsl-semantic-query.md) is not supported for querying the field data.
|
In case you want to customize data indexing, use the [`sparse_vector`](/reference/elasticsearch/mapping-reference/sparse-vector.md) or [`dense_vector`](/reference/elasticsearch/mapping-reference/dense-vector.md) field types and create an ingest pipeline with an [{{infer}} processor](/reference/ingestion-tools/enrich-processor/inference-processor.md) to generate the embeddings. [This tutorial](docs-content://solutions/search/semantic-search/semantic-search-inference.md) walks you through the process. In these cases - when you use `sparse_vector` or `dense_vector` field types instead of the `semantic_text` field type to customize indexing - using the [`semantic_query`](/reference/query-languages/query-dsl/query-dsl-semantic-query.md) is not supported for querying the field data.
|
||||||
|
|
||||||
|
|
||||||
## Updates to `semantic_text` fields [update-script]
|
## Updates to `semantic_text` fields [update-script]
|
||||||
|
|
|
@ -9,7 +9,7 @@ mapped_pages:
|
||||||
|
|
||||||
The `shape` data type facilitates the indexing of and searching with arbitrary `x, y` cartesian shapes such as rectangles and polygons. It can be used to index and query geometries whose coordinates fall in a 2-dimensional planar coordinate system.
|
The `shape` data type facilitates the indexing of and searching with arbitrary `x, y` cartesian shapes such as rectangles and polygons. It can be used to index and query geometries whose coordinates fall in a 2-dimensional planar coordinate system.
|
||||||
|
|
||||||
You can query documents using this type using [shape Query](/reference/query-languages/query-dsl-shape-query.md).
|
You can query documents using this type using [shape Query](/reference/query-languages/query-dsl/query-dsl-shape-query.md).
|
||||||
|
|
||||||
|
|
||||||
## Mapping Options [shape-mapping-options]
|
## Mapping Options [shape-mapping-options]
|
||||||
|
|
|
@ -7,7 +7,7 @@ mapped_pages:
|
||||||
# Sparse vector field type [sparse-vector]
|
# Sparse vector field type [sparse-vector]
|
||||||
|
|
||||||
|
|
||||||
A `sparse_vector` field can index features and weights so that they can later be used to query documents in queries with a [`sparse_vector`](/reference/query-languages/query-dsl-sparse-vector-query.md). This field can also be used with a legacy [`text_expansion`](/reference/query-languages/query-dsl-text-expansion-query.md) query.
|
A `sparse_vector` field can index features and weights so that they can later be used to query documents in queries with a [`sparse_vector`](/reference/query-languages/query-dsl/query-dsl-sparse-vector-query.md). This field can also be used with a legacy [`text_expansion`](/reference/query-languages/query-dsl/query-dsl-text-expansion-query.md) query.
|
||||||
|
|
||||||
`sparse_vector` is the field type that should be used with [ELSER mappings](docs-content://solutions/search/semantic-search/semantic-search-elser-ingest-pipelines.md#elser-mappings).
|
`sparse_vector` is the field type that should be used with [ELSER mappings](docs-content://solutions/search/semantic-search/semantic-search-elser-ingest-pipelines.md#elser-mappings).
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ GET my-index-000001/_search
|
||||||
|
|
||||||
|
|
||||||
::::{note}
|
::::{note}
|
||||||
`sparse_vector` fields do not support [analyzers](docs-content://manage-data/data-store/text-analysis.md), querying, sorting or aggregating. They may only be used within specialized queries. The recommended query to use on these fields are [`sparse_vector`](/reference/query-languages/query-dsl-sparse-vector-query.md) queries. They may also be used within legacy [`text_expansion`](/reference/query-languages/query-dsl-text-expansion-query.md) queries.
|
`sparse_vector` fields do not support [analyzers](docs-content://manage-data/data-store/text-analysis.md), querying, sorting or aggregating. They may only be used within specialized queries. The recommended query to use on these fields are [`sparse_vector`](/reference/query-languages/query-dsl/query-dsl-sparse-vector-query.md) queries. They may also be used within legacy [`text_expansion`](/reference/query-languages/query-dsl/query-dsl-text-expansion-query.md) queries.
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ Will become:
|
||||||
```
|
```
|
||||||
|
|
||||||
::::{note}
|
::::{note}
|
||||||
Reordering text fields can have an effect on [phrase](/reference/query-languages/query-dsl-match-query-phrase.md) and [span](/reference/query-languages/span-queries.md) queries. See the discussion about [`position_increment_gap`](/reference/elasticsearch/mapping-reference/position-increment-gap.md) for more detail. You can avoid this by making sure the `slop` parameter on the phrase queries is lower than the `position_increment_gap`. This is the default.
|
Reordering text fields can have an effect on [phrase](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md) and [span](/reference/query-languages/query-dsl/span-queries.md) queries. See the discussion about [`position_increment_gap`](/reference/elasticsearch/mapping-reference/position-increment-gap.md) for more detail. You can avoid this by making sure the `slop` parameter on the phrase queries is lower than the `position_increment_gap`. This is the default.
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
||||||
|
@ -297,11 +297,11 @@ PUT my-index-000001
|
||||||
|
|
||||||
## Match-only text field type [match-only-text-field-type]
|
## Match-only text field type [match-only-text-field-type]
|
||||||
|
|
||||||
A variant of [`text`](#text-field-type) that trades scoring and efficiency of positional queries for space efficiency. This field effectively stores data the same way as a `text` field that only indexes documents (`index_options: docs`) and disables norms (`norms: false`). Term queries perform as fast if not faster as on `text` fields, however queries that need positions such as the [`match_phrase` query](/reference/query-languages/query-dsl-match-query-phrase.md) perform slower as they need to look at the `_source` document to verify whether a phrase matches. All queries return constant scores that are equal to 1.0.
|
A variant of [`text`](#text-field-type) that trades scoring and efficiency of positional queries for space efficiency. This field effectively stores data the same way as a `text` field that only indexes documents (`index_options: docs`) and disables norms (`norms: false`). Term queries perform as fast if not faster as on `text` fields, however queries that need positions such as the [`match_phrase` query](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md) perform slower as they need to look at the `_source` document to verify whether a phrase matches. All queries return constant scores that are equal to 1.0.
|
||||||
|
|
||||||
Analysis is not configurable: text is always analyzed with the [default analyzer](docs-content://manage-data/data-store/text-analysis/specify-an-analyzer.md#specify-index-time-default-analyzer) ([`standard`](/reference/data-analysis/text-analysis/analysis-standard-analyzer.md) by default).
|
Analysis is not configurable: text is always analyzed with the [default analyzer](docs-content://manage-data/data-store/text-analysis/specify-an-analyzer.md#specify-index-time-default-analyzer) ([`standard`](/reference/data-analysis/text-analysis/analysis-standard-analyzer.md) by default).
|
||||||
|
|
||||||
[span queries](/reference/query-languages/span-queries.md) are not supported with this field, use [interval queries](/reference/query-languages/query-dsl-intervals-query.md) instead, or the [`text`](#text-field-type) field type if you absolutely need span queries.
|
[span queries](/reference/query-languages/query-dsl/span-queries.md) are not supported with this field, use [interval queries](/reference/query-languages/query-dsl/query-dsl-intervals-query.md) instead, or the [`text`](#text-field-type) field type if you absolutely need span queries.
|
||||||
|
|
||||||
Other than that, `match_only_text` supports the same queries as `text`. And like `text`, it does not support sorting and has only limited support for aggregations.
|
Other than that, `match_only_text` supports the same queries as `text`. And like `text`, it does not support sorting and has only limited support for aggregations.
|
||||||
|
|
||||||
|
|
|
@ -466,7 +466,7 @@ Whenever the byte size of data needs to be specified, e.g. when setting a buffer
|
||||||
|
|
||||||
## Distance Units [distance-units]
|
## Distance Units [distance-units]
|
||||||
|
|
||||||
Wherever distances need to be specified, such as the `distance` parameter in the [Geo-distance](/reference/query-languages/query-dsl-geo-distance-query.md)), the default unit is meters if none is specified. Distances can be specified in other units, such as `"1km"` or `"2mi"` (2 miles).
|
Wherever distances need to be specified, such as the `distance` parameter in the [Geo-distance](/reference/query-languages/query-dsl/query-dsl-geo-distance-query.md)), the default unit is meters if none is specified. Distances can be specified in other units, such as `"1km"` or `"2mi"` (2 miles).
|
||||||
|
|
||||||
The full list of units is listed below:
|
The full list of units is listed below:
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ Statistics are returned in a format suitable for humans (e.g. `"exists_time": "1
|
||||||
|
|
||||||
## Date Math [date-math]
|
## Date Math [date-math]
|
||||||
|
|
||||||
Most parameters which accept a formatted date value — such as `gt` and `lt` in [`range` queries](/reference/query-languages/query-dsl-range-query.md), or `from` and `to` in [`daterange` aggregations](/reference/data-analysis/aggregations/search-aggregations-bucket-daterange-aggregation.md) — understand date maths.
|
Most parameters which accept a formatted date value — such as `gt` and `lt` in [`range` queries](/reference/query-languages/query-dsl/query-dsl-range-query.md), or `from` and `to` in [`daterange` aggregations](/reference/data-analysis/aggregations/search-aggregations-bucket-daterange-aggregation.md) — understand date maths.
|
||||||
|
|
||||||
The expression starts with an anchor date, which can either be `now`, or a date string ending with `||`. This anchor date can optionally be followed by one or more maths expressions:
|
The expression starts with an anchor date, which can either be `now`, or a date string ending with `||`. This anchor date can optionally be followed by one or more maths expressions:
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ applies_to:
|
||||||
|
|
||||||
You can use two methods to filter search results:
|
You can use two methods to filter search results:
|
||||||
|
|
||||||
* Use a boolean query with a `filter` clause. Search requests apply [boolean filters](/reference/query-languages/query-dsl-bool-query.md) to both search hits and [aggregations](/reference/data-analysis/aggregations/index.md).
|
* Use a boolean query with a `filter` clause. Search requests apply [boolean filters](/reference/query-languages/query-dsl/query-dsl-bool-query.md) to both search hits and [aggregations](/reference/data-analysis/aggregations/index.md).
|
||||||
* Use the search API’s `post_filter` parameter. Search requests apply [post filters](#post-filter) only to search hits, not aggregations. You can use a post filter to calculate aggregations based on a broader result set, and then further narrow the results.
|
* Use the search API’s `post_filter` parameter. Search requests apply [post filters](#post-filter) only to search hits, not aggregations. You can use a post filter to calculate aggregations based on a broader result set, and then further narrow the results.
|
||||||
|
|
||||||
You can also [rescore](#rescore) hits after the post filter to improve relevance and reorder results.
|
You can also [rescore](#rescore) hits after the post filter to improve relevance and reorder results.
|
||||||
|
@ -44,7 +44,7 @@ PUT /shirts/_doc/1?refresh
|
||||||
|
|
||||||
Imagine a user has specified two filters:
|
Imagine a user has specified two filters:
|
||||||
|
|
||||||
`color:red` and `brand:gucci`. You only want to show them red shirts made by Gucci in the search results. Normally you would do this with a [`bool` query](/reference/query-languages/query-dsl-bool-query.md):
|
`color:red` and `brand:gucci`. You only want to show them red shirts made by Gucci in the search results. Normally you would do this with a [`bool` query](/reference/query-languages/query-dsl/query-dsl-bool-query.md):
|
||||||
|
|
||||||
```console
|
```console
|
||||||
GET /shirts/_search
|
GET /shirts/_search
|
||||||
|
@ -189,7 +189,7 @@ The way the scores are combined can be controlled with the `score_mode`:
|
||||||
| Score Mode | Description |
|
| Score Mode | Description |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `total` | Add the original score and the rescore query score. The default. |
|
| `total` | Add the original score and the rescore query score. The default. |
|
||||||
| `multiply` | Multiply the original score by the rescore query score. Usefulfor [`function query`](/reference/query-languages/query-dsl-function-score-query.md) rescores. |
|
| `multiply` | Multiply the original score by the rescore query score. Usefulfor [`function query`](/reference/query-languages/query-dsl/query-dsl-function-score-query.md) rescores. |
|
||||||
| `avg` | Average the original score and the rescore query score. |
|
| `avg` | Average the original score and the rescore query score. |
|
||||||
| `max` | Take the max of original score and the rescore query score. |
|
| `max` | Take the max of original score and the rescore query score. |
|
||||||
| `min` | Take the min of the original score and the rescore query score. |
|
| `min` | Take the min of the original score and the rescore query score. |
|
||||||
|
|
|
@ -539,7 +539,7 @@ In addition to individual query scoring details, we can make use of the `explain
|
||||||
6. the `value` heres specifies the `rank` of this document for the second (`knn`) query
|
6. the `value` heres specifies the `rank` of this document for the second (`knn`) query
|
||||||
|
|
||||||
|
|
||||||
In addition to the above, explain in RRF also supports [named queries](/reference/query-languages/query-dsl-bool-query.md#named-queries) using the `_name` parameter. Using named queries allows for easier and more intuitive understanding of the RRF score computation, especially when dealing with multiple queries. So, we would now have:
|
In addition to the above, explain in RRF also supports [named queries](/reference/query-languages/query-dsl/query-dsl-bool-query.md#named-queries) using the `_name` parameter. Using named queries allows for easier and more intuitive understanding of the RRF score computation, especially when dealing with multiple queries. So, we would now have:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
GET example-index/_search
|
GET example-index/_search
|
||||||
|
|
|
@ -60,7 +60,7 @@ A standard retriever returns top documents from a traditional [query](/reference
|
||||||
`filter`
|
`filter`
|
||||||
: (Optional, [query object or list of query objects](/reference/query-languages/querydsl.md))
|
: (Optional, [query object or list of query objects](/reference/query-languages/querydsl.md))
|
||||||
|
|
||||||
Applies a [boolean query filter](/reference/query-languages/query-dsl-bool-query.md) to this retriever, where all documents must match this query but do not contribute to the score.
|
Applies a [boolean query filter](/reference/query-languages/query-dsl/query-dsl-bool-query.md) to this retriever, where all documents must match this query but do not contribute to the score.
|
||||||
|
|
||||||
|
|
||||||
`search_after`
|
`search_after`
|
||||||
|
@ -84,7 +84,7 @@ A standard retriever returns top documents from a traditional [query](/reference
|
||||||
`min_score`
|
`min_score`
|
||||||
: (Optional, `float`)
|
: (Optional, `float`)
|
||||||
|
|
||||||
Minimum [`_score`](/reference/query-languages/query-filter-context.md#relevance-scores) for matching documents. Documents with a lower `_score` are not included in the top documents.
|
Minimum [`_score`](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores) for matching documents. Documents with a lower `_score` are not included in the top documents.
|
||||||
|
|
||||||
|
|
||||||
`collapse`
|
`collapse`
|
||||||
|
@ -294,7 +294,7 @@ See also [this hybrid search example](docs-content://solutions/search/retrievers
|
||||||
`filter`
|
`filter`
|
||||||
: (Optional, [query object or list of query objects](/reference/query-languages/querydsl.md))
|
: (Optional, [query object or list of query objects](/reference/query-languages/querydsl.md))
|
||||||
|
|
||||||
Applies the specified [boolean query filter](/reference/query-languages/query-dsl-bool-query.md) to all of the specified sub-retrievers, according to each retriever’s specifications.
|
Applies the specified [boolean query filter](/reference/query-languages/query-dsl/query-dsl-bool-query.md) to all of the specified sub-retrievers, according to each retriever’s specifications.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ An [RRF](/reference/elasticsearch/rest-apis/reciprocal-rank-fusion.md) retriever
|
||||||
`filter`
|
`filter`
|
||||||
: (Optional, [query object or list of query objects](/reference/query-languages/querydsl.md))
|
: (Optional, [query object or list of query objects](/reference/query-languages/querydsl.md))
|
||||||
|
|
||||||
Applies the specified [boolean query filter](/reference/query-languages/query-dsl-bool-query.md) to all of the specified sub-retrievers, according to each retriever’s specifications.
|
Applies the specified [boolean query filter](/reference/query-languages/query-dsl/query-dsl-bool-query.md) to all of the specified sub-retrievers, according to each retriever’s specifications.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -463,7 +463,7 @@ When using the `rescorer`, an error is returned if the following conditions are
|
||||||
`filter`
|
`filter`
|
||||||
: (Optional. [query object or list of query objects](/reference/query-languages/querydsl.md))
|
: (Optional. [query object or list of query objects](/reference/query-languages/querydsl.md))
|
||||||
|
|
||||||
Applies a [boolean query filter](/reference/query-languages/query-dsl-bool-query.md) to the retriever, ensuring that all documents match the filter criteria without affecting their scores.
|
Applies a [boolean query filter](/reference/query-languages/query-dsl/query-dsl-bool-query.md) to the retriever, ensuring that all documents match the filter criteria without affecting their scores.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -632,7 +632,7 @@ score = ln(score), if score < 0
|
||||||
`filter`
|
`filter`
|
||||||
: (Optional, [query object or list of query objects](/reference/query-languages/querydsl.md))
|
: (Optional, [query object or list of query objects](/reference/query-languages/querydsl.md))
|
||||||
|
|
||||||
Applies the specified [boolean query filter](/reference/query-languages/query-dsl-bool-query.md) to the child `retriever`. If the child retriever already specifies any filters, then this top-level filter is applied in conjuction with the filter defined in the child retriever.
|
Applies the specified [boolean query filter](/reference/query-languages/query-dsl/query-dsl-bool-query.md) to the child `retriever`. If the child retriever already specifies any filters, then this top-level filter is applied in conjuction with the filter defined in the child retriever.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -800,7 +800,7 @@ Follow these steps to load the model and create a semantic re-ranker.
|
||||||
|
|
||||||
## Query Rules Retriever [rule-retriever]
|
## Query Rules Retriever [rule-retriever]
|
||||||
|
|
||||||
The `rule` retriever enables fine-grained control over search results by applying contextual [query rules](/reference/elasticsearch/rest-apis/searching-with-query-rules.md#query-rules) to pin or exclude documents for specific queries. This retriever has similar functionality to the [rule query](/reference/query-languages/query-dsl-rule-query.md), but works out of the box with other retrievers.
|
The `rule` retriever enables fine-grained control over search results by applying contextual [query rules](/reference/elasticsearch/rest-apis/searching-with-query-rules.md#query-rules) to pin or exclude documents for specific queries. This retriever has similar functionality to the [rule query](/reference/query-languages/query-dsl/query-dsl-rule-query.md), but works out of the box with other retrievers.
|
||||||
|
|
||||||
### Prerequisites [_prerequisites_16]
|
### Prerequisites [_prerequisites_16]
|
||||||
|
|
||||||
|
@ -929,7 +929,7 @@ The [`from`](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operati
|
||||||
|
|
||||||
### Using aggregations with a retriever tree [retriever-aggregations]
|
### Using aggregations with a retriever tree [retriever-aggregations]
|
||||||
|
|
||||||
[Aggregations](/reference/data-analysis/aggregations/index.md) are globally specified as part of a search request. The query used for an aggregation is the combination of all leaf retrievers as `should` clauses in a [boolean query](/reference/query-languages/query-dsl-bool-query.md).
|
[Aggregations](/reference/data-analysis/aggregations/index.md) are globally specified as part of a search request. The query used for an aggregation is the combination of all leaf retrievers as `should` clauses in a [boolean query](/reference/query-languages/query-dsl/query-dsl-bool-query.md).
|
||||||
|
|
||||||
|
|
||||||
### Restrictions on search parameters when specifying a retriever [retriever-restrictions]
|
### Restrictions on search parameters when specifying a retriever [retriever-restrictions]
|
||||||
|
|
|
@ -782,7 +782,7 @@ POST music/_search?pretty
|
||||||
The regex query can take specific regex parameters. For example:
|
The regex query can take specific regex parameters. For example:
|
||||||
|
|
||||||
`flags`
|
`flags`
|
||||||
: Possible flags are `ALL` (default), `ANYSTRING`, `COMPLEMENT`, `EMPTY`, `INTERSECTION`, `INTERVAL`, or `NONE`. See [regexp-syntax](/reference/query-languages/query-dsl-regexp-query.md) for their meaning
|
: Possible flags are `ALL` (default), `ANYSTRING`, `COMPLEMENT`, `EMPTY`, `INTERSECTION`, `INTERVAL`, or `NONE`. See [regexp-syntax](/reference/query-languages/query-dsl/query-dsl-regexp-query.md) for their meaning
|
||||||
|
|
||||||
`max_determinized_states`
|
`max_determinized_states`
|
||||||
: Regular expressions are dangerous because it's easy to accidentally create an innocuous looking one that requires an exponential number of internal determinized automaton states (and corresponding RAM and CPU) for Lucene to execute. Lucene prevents these using the `max_determinized_states` setting (defaults to 10000). You can raise this limit to allow more complex regular expressions to execute.
|
: Regular expressions are dangerous because it's easy to accidentally create an innocuous looking one that requires an exponential number of internal determinized automaton states (and corresponding RAM and CPU) for Lucene to execute. Lucene prevents these using the `max_determinized_states` setting (defaults to 10000). You can raise this limit to allow more complex regular expressions to execute.
|
||||||
|
|
|
@ -24,7 +24,7 @@ When a query rule matches the rule metadata according to its defined criteria, t
|
||||||
|
|
||||||
For example, a query rule could be defined to match a user-entered query string of `pugs` and a country `us` and promote adoptable shelter dogs if the rule query met both criteria.
|
For example, a query rule could be defined to match a user-entered query string of `pugs` and a country `us` and promote adoptable shelter dogs if the rule query met both criteria.
|
||||||
|
|
||||||
Rules are defined using the [query rules API](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-query_rules) and searched using the [rule retriever](/reference/elasticsearch/rest-apis/retrievers.md#rule-retriever) or the [rule query](/reference/query-languages/query-dsl-rule-query.md).
|
Rules are defined using the [query rules API](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-query_rules) and searched using the [rule retriever](/reference/elasticsearch/rest-apis/retrievers.md#rule-retriever) or the [rule query](/reference/query-languages/query-dsl/query-dsl-rule-query.md).
|
||||||
|
|
||||||
|
|
||||||
## Rule definition [query-rule-definition]
|
## Rule definition [query-rule-definition]
|
||||||
|
@ -36,7 +36,7 @@ When defining a rule, consider the following:
|
||||||
|
|
||||||
The type of rule we want to apply. We support the following rule types:
|
The type of rule we want to apply. We support the following rule types:
|
||||||
|
|
||||||
* `pinned` will re-write the query into a [pinned query](/reference/query-languages/query-dsl-pinned-query.md), pinning specified results matching the query rule at the top of the returned result set.
|
* `pinned` will re-write the query into a [pinned query](/reference/query-languages/query-dsl/query-dsl-pinned-query.md), pinning specified results matching the query rule at the top of the returned result set.
|
||||||
* `exclude` will exclude specified results from the returned result set.
|
* `exclude` will exclude specified results from the returned result set.
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ You can add query rules using the [Create or update query ruleset](https://www.e
|
||||||
|
|
||||||
The following command will create a query ruleset called `my-ruleset` with two query rules:
|
The following command will create a query ruleset called `my-ruleset` with two query rules:
|
||||||
|
|
||||||
* The first rule will generate a [Pinned Query](/reference/query-languages/query-dsl-pinned-query.md) pinning the [`_id`](/reference/elasticsearch/mapping-reference/mapping-id-field.md)s `id1` and `id2` when the `query_string` metadata value is a fuzzy match to either `puggles` or `pugs` *and* the user’s location is in the US.
|
* The first rule will generate a [Pinned Query](/reference/query-languages/query-dsl/query-dsl-pinned-query.md) pinning the [`_id`](/reference/elasticsearch/mapping-reference/mapping-id-field.md)s `id1` and `id2` when the `query_string` metadata value is a fuzzy match to either `puggles` or `pugs` *and* the user’s location is in the US.
|
||||||
* The second rule will generate a query that excludes the [`_id`](/reference/elasticsearch/mapping-reference/mapping-id-field.md) `id3` specifically from the `my-index-000001` index and `id4` from the `my-index-000002` index when the `query_string` metadata value contains `beagles`.
|
* The second rule will generate a query that excludes the [`_id`](/reference/elasticsearch/mapping-reference/mapping-id-field.md) `id3` specifically from the `my-index-000001` index and `id4` from the `my-index-000002` index when the `query_string` metadata value contains `beagles`.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
|
@ -148,7 +148,7 @@ You can use the [Get query ruleset](https://www.elastic.co/docs/api/doc/elastics
|
||||||
|
|
||||||
## Search using query rules [rule-query-search]
|
## Search using query rules [rule-query-search]
|
||||||
|
|
||||||
Once you have defined one or more query rulesets, you can search using these rulesets using the [rule retriever](/reference/elasticsearch/rest-apis/retrievers.md#rule-retriever) or the [rule query](/reference/query-languages/query-dsl-rule-query.md). Retrievers are the recommended way to use rule queries, as they will work out of the box with other reranking retrievers such as [Reciprocal rank fusion](/reference/elasticsearch/rest-apis/reciprocal-rank-fusion.md).
|
Once you have defined one or more query rulesets, you can search using these rulesets using the [rule retriever](/reference/elasticsearch/rest-apis/retrievers.md#rule-retriever) or the [rule query](/reference/query-languages/query-dsl/query-dsl-rule-query.md). Retrievers are the recommended way to use rule queries, as they will work out of the box with other reranking retrievers such as [Reciprocal rank fusion](/reference/elasticsearch/rest-apis/reciprocal-rank-fusion.md).
|
||||||
|
|
||||||
Rulesets are evaluated in order, so rules in the first ruleset you specify will be applied before any subsequent rulesets.
|
Rulesets are evaluated in order, so rules in the first ruleset you specify will be applied before any subsequent rulesets.
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ GET /my-index-000001/_search
|
||||||
|
|
||||||
This rule query will match against `rule1` in the defined query ruleset, and will convert the organic query into a pinned query with `id1` and `id2` pinned as the top hits. Any other matches from the organic query will be returned below the pinned results.
|
This rule query will match against `rule1` in the defined query ruleset, and will convert the organic query into a pinned query with `id1` and `id2` pinned as the top hits. Any other matches from the organic query will be returned below the pinned results.
|
||||||
|
|
||||||
It’s possible to have multiple rules in a ruleset match a single [rule query](/reference/query-languages/query-dsl-rule-query.md). In this case, the rules are applied in the following order:
|
It’s possible to have multiple rules in a ruleset match a single [rule query](/reference/query-languages/query-dsl/query-dsl-rule-query.md). In this case, the rules are applied in the following order:
|
||||||
|
|
||||||
* Where the matching rule appears in the ruleset
|
* Where the matching rule appears in the ruleset
|
||||||
* If multiple documents are specified in a single rule, in the order they are specified
|
* If multiple documents are specified in a single rule, in the order they are specified
|
||||||
|
|
|
@ -19,7 +19,7 @@ $$$enrich-options$$$
|
||||||
| `ignore_missing` | no | false | If `true` and `field` does not exist, the processor quietly exits without modifying the document |
|
| `ignore_missing` | no | false | If `true` and `field` does not exist, the processor quietly exits without modifying the document |
|
||||||
| `override` | no | true | If processor will update fields with pre-existing non-null-valued field. When set to `false`, such fields will not be touched. |
|
| `override` | no | true | If processor will update fields with pre-existing non-null-valued field. When set to `false`, such fields will not be touched. |
|
||||||
| `max_matches` | no | 1 | The maximum number of matched documents to include under the configured target field. The `target_field` will be turned into a json array if `max_matches` is higher than 1, otherwise `target_field` will become a json object. In order to avoid documents getting too large, the maximum allowed value is 128. |
|
| `max_matches` | no | 1 | The maximum number of matched documents to include under the configured target field. The `target_field` will be turned into a json array if `max_matches` is higher than 1, otherwise `target_field` will become a json object. In order to avoid documents getting too large, the maximum allowed value is 128. |
|
||||||
| `shape_relation` | no | `INTERSECTS` | A spatial relation operator used to match the [geoshape](/reference/elasticsearch/mapping-reference/geo-shape.md) of incoming documents to documents in the enrich index. This option is only used for `geo_match` enrich policy types. See [Spatial Relations](/reference/query-languages/query-dsl-shape-query.md#_spatial_relations) for operators and more information. |
|
| `shape_relation` | no | `INTERSECTS` | A spatial relation operator used to match the [geoshape](/reference/elasticsearch/mapping-reference/geo-shape.md) of incoming documents to documents in the enrich index. This option is only used for `geo_match` enrich policy types. See [Spatial Relations](/reference/query-languages/query-dsl/query-dsl-shape-query.md#_spatial_relations) for operators and more information. |
|
||||||
| `description` | no | - | Description of the processor. Useful for describing the purpose of the processor or its configuration. |
|
| `description` | no | - | Description of the processor. Useful for describing the purpose of the processor or its configuration. |
|
||||||
| `if` | no | - | Conditionally execute the processor. See [Conditionally run a processor](docs-content://manage-data/ingest/transform-enrich/ingest-pipelines.md#conditionally-run-processor). |
|
| `if` | no | - | Conditionally execute the processor. See [Conditionally run a processor](docs-content://manage-data/ingest/transform-enrich/ingest-pipelines.md#conditionally-run-processor). |
|
||||||
| `ignore_failure` | no | `false` | Ignore failures for the processor. See [Handling pipeline failures](docs-content://manage-data/ingest/transform-enrich/ingest-pipelines.md#handling-pipeline-failures). |
|
| `ignore_failure` | no | `false` | Ignore failures for the processor. See [Handling pipeline failures](docs-content://manage-data/ingest/transform-enrich/ingest-pipelines.md#handling-pipeline-failures). |
|
||||||
|
|
|
@ -19,7 +19,7 @@ Event Query Language (EQL) is a query language for event-based time series data,
|
||||||
## Advantages of EQL [eql-advantages]
|
## Advantages of EQL [eql-advantages]
|
||||||
|
|
||||||
* **EQL lets you express relationships between events.**<br> Many query languages allow you to match single events. EQL lets you match a sequence of events across different event categories and time spans.
|
* **EQL lets you express relationships between events.**<br> Many query languages allow you to match single events. EQL lets you match a sequence of events across different event categories and time spans.
|
||||||
* **EQL has a low learning curve.**<br> [EQL syntax](/reference/query-languages/eql-syntax.md) looks like other common query languages, such as SQL. EQL lets you write and read queries intuitively, which makes for quick, iterative searching.
|
* **EQL has a low learning curve.**<br> [EQL syntax](/reference/query-languages/eql/eql-syntax.md) looks like other common query languages, such as SQL. EQL lets you write and read queries intuitively, which makes for quick, iterative searching.
|
||||||
* **EQL is designed for security use cases.**<br> While you can use it for any event-based data, we created EQL for threat hunting. EQL not only supports indicator of compromise (IOC) searches but can describe activity that goes beyond IOCs.
|
* **EQL is designed for security use cases.**<br> While you can use it for any event-based data, we created EQL for threat hunting. EQL not only supports indicator of compromise (IOC) searches but can describe activity that goes beyond IOCs.
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ Event Query Language (EQL) is a query language for event-based time series data,
|
||||||
|
|
||||||
With the exception of sample queries, EQL searches require that the searched data stream or index contains a *timestamp* field. By default, EQL uses the `@timestamp` field from the [Elastic Common Schema (ECS)][Elastic Common Schema (ECS)](ecs://reference/index.md)).
|
With the exception of sample queries, EQL searches require that the searched data stream or index contains a *timestamp* field. By default, EQL uses the `@timestamp` field from the [Elastic Common Schema (ECS)][Elastic Common Schema (ECS)](ecs://reference/index.md)).
|
||||||
|
|
||||||
EQL searches also require an *event category* field, unless you use the [`any` keyword](/reference/query-languages/eql-syntax.md#eql-syntax-match-any-event-category) to search for documents without an event category field. By default, EQL uses the ECS `event.category` field.
|
EQL searches also require an *event category* field, unless you use the [`any` keyword](/reference/query-languages/eql/eql-syntax.md#eql-syntax-match-any-event-category) to search for documents without an event category field. By default, EQL uses the ECS `event.category` field.
|
||||||
|
|
||||||
To use a different timestamp or event category field, see [Specify a timestamp or event category field](#specify-a-timestamp-or-event-category-field).
|
To use a different timestamp or event category field, see [Specify a timestamp or event category field](#specify-a-timestamp-or-event-category-field).
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ While no schema is required to use EQL, we recommend using the [ECS](ecs://refer
|
||||||
|
|
||||||
## Run an EQL search [run-an-eql-search]
|
## Run an EQL search [run-an-eql-search]
|
||||||
|
|
||||||
Use the [EQL search API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-eql-search) to run a [basic EQL query](/reference/query-languages/eql-syntax.md#eql-basic-syntax).
|
Use the [EQL search API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-eql-search) to run a [basic EQL query](/reference/query-languages/eql/eql-syntax.md#eql-basic-syntax).
|
||||||
|
|
||||||
```console
|
```console
|
||||||
GET /my-data-stream/_eql/search
|
GET /my-data-stream/_eql/search
|
||||||
|
@ -120,7 +120,7 @@ GET /my-data-stream/_eql/search
|
||||||
|
|
||||||
## Search for a sequence of events [eql-search-sequence]
|
## Search for a sequence of events [eql-search-sequence]
|
||||||
|
|
||||||
Use EQL’s [sequence syntax](/reference/query-languages/eql-syntax.md#eql-sequences) to search for a series of ordered events. List the event items in ascending chronological order, with the most recent event listed last:
|
Use EQL’s [sequence syntax](/reference/query-languages/eql/eql-syntax.md#eql-sequences) to search for a series of ordered events. List the event items in ascending chronological order, with the most recent event listed last:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
GET /my-data-stream/_eql/search
|
GET /my-data-stream/_eql/search
|
||||||
|
@ -189,7 +189,7 @@ The response’s `hits.sequences` property contains the 10 most recent matching
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Use [`with maxspan`](/reference/query-languages/eql-syntax.md#eql-with-maxspan-keywords) to constrain matching sequences to a timespan:
|
Use [`with maxspan`](/reference/query-languages/eql/eql-syntax.md#eql-with-maxspan-keywords) to constrain matching sequences to a timespan:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
GET /my-data-stream/_eql/search
|
GET /my-data-stream/_eql/search
|
||||||
|
@ -202,7 +202,7 @@ GET /my-data-stream/_eql/search
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Use `!` to match [missing events](/reference/query-languages/eql-syntax.md#eql-missing-events): events in a sequence that do not meet a condition within a given timespan:
|
Use `!` to match [missing events](/reference/query-languages/eql/eql-syntax.md#eql-missing-events): events in a sequence that do not meet a condition within a given timespan:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
GET /my-data-stream/_eql/search
|
GET /my-data-stream/_eql/search
|
||||||
|
@ -277,7 +277,7 @@ Missing events are indicated in the response as `missing": true`:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Use the [`by` keyword](/reference/query-languages/eql-syntax.md#eql-by-keyword) to match events that share the same field values:
|
Use the [`by` keyword](/reference/query-languages/eql/eql-syntax.md#eql-by-keyword) to match events that share the same field values:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
GET /my-data-stream/_eql/search
|
GET /my-data-stream/_eql/search
|
||||||
|
@ -321,7 +321,7 @@ The `hits.sequences.join_keys` property contains the shared field values.
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Use the [`until` keyword](/reference/query-languages/eql-syntax.md#eql-until-keyword) to specify an expiration event for sequences. Matching sequences must end before this event.
|
Use the [`until` keyword](/reference/query-languages/eql/eql-syntax.md#eql-until-keyword) to specify an expiration event for sequences. Matching sequences must end before this event.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
GET /my-data-stream/_eql/search
|
GET /my-data-stream/_eql/search
|
||||||
|
@ -338,7 +338,7 @@ GET /my-data-stream/_eql/search
|
||||||
|
|
||||||
## Sample chronologically unordered events [eql-search-sample]
|
## Sample chronologically unordered events [eql-search-sample]
|
||||||
|
|
||||||
Use EQL’s [sample syntax](/reference/query-languages/eql-syntax.md#eql-samples) to search for events that match one or more join keys and a set of filters. Samples are similar to sequences, but do not return events in chronological order. In fact, sample queries can run on data without a timestamp. Sample queries can be useful to find correlations in events that don’t always occur in the same sequence, or that occur across long time spans.
|
Use EQL’s [sample syntax](/reference/query-languages/eql/eql-syntax.md#eql-samples) to search for events that match one or more join keys and a set of filters. Samples are similar to sequences, but do not return events in chronological order. In fact, sample queries can run on data without a timestamp. Sample queries can be useful to find correlations in events that don’t always occur in the same sequence, or that occur across long time spans.
|
||||||
|
|
||||||
::::{dropdown} Click to show the sample data used in the examples below
|
::::{dropdown} Click to show the sample data used in the examples below
|
||||||
```console
|
```console
|
||||||
|
@ -554,7 +554,7 @@ POST /my-index-000003/_bulk?refresh
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
||||||
A sample query specifies at least one join key, using the [`by` keyword](/reference/query-languages/eql-syntax.md#eql-by-keyword), and up to five filters:
|
A sample query specifies at least one join key, using the [`by` keyword](/reference/query-languages/eql/eql-syntax.md#eql-by-keyword), and up to five filters:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
GET /my-index*/_eql/search
|
GET /my-index*/_eql/search
|
||||||
|
|
|
@ -204,7 +204,7 @@ The query matches an event, confirming `scrobj.dll` was loaded.
|
||||||
|
|
||||||
## Determine the likelihood of success [eql-ex-detemine-likelihood-of-success]
|
## Determine the likelihood of success [eql-ex-detemine-likelihood-of-success]
|
||||||
|
|
||||||
In many cases, attackers use malicious scripts to connect to remote servers or download other files. Use an [EQL sequence query](/reference/query-languages/eql-syntax.md#eql-sequences) to check for the following series of events:
|
In many cases, attackers use malicious scripts to connect to remote servers or download other files. Use an [EQL sequence query](/reference/query-languages/eql/eql-syntax.md#eql-sequences) to check for the following series of events:
|
||||||
|
|
||||||
1. A `regsvr32.exe` process
|
1. A `regsvr32.exe` process
|
||||||
2. A load of the `scrobj.dll` library by the same process
|
2. A load of the `scrobj.dll` library by the same process
|
|
@ -7,7 +7,7 @@ mapped_pages:
|
||||||
# EQL function reference [eql-function-ref]
|
# EQL function reference [eql-function-ref]
|
||||||
|
|
||||||
|
|
||||||
{{es}} supports the following [EQL functions](/reference/query-languages/eql-syntax.md#eql-functions).
|
{{es}} supports the following [EQL functions](/reference/query-languages/eql/eql-syntax.md#eql-functions).
|
||||||
|
|
||||||
|
|
||||||
## `add` [eql-fn-add]
|
## `add` [eql-fn-add]
|
|
@ -7,7 +7,7 @@ mapped_pages:
|
||||||
# EQL pipe reference [eql-pipe-ref]
|
# EQL pipe reference [eql-pipe-ref]
|
||||||
|
|
||||||
|
|
||||||
{{es}} supports the following [EQL pipes](/reference/query-languages/eql-syntax.md#eql-pipes).
|
{{es}} supports the following [EQL pipes](/reference/query-languages/eql/eql-syntax.md#eql-pipes).
|
||||||
|
|
||||||
|
|
||||||
## `head` [eql-pipe-head]
|
## `head` [eql-pipe-head]
|
|
@ -130,7 +130,7 @@ my_field regex~ "value[^z].?" // case-insensitive regex matching
|
||||||
: Returns `true` if the string to the left of the keyword matches a [wildcard pattern](#eql-syntax-wildcards) to the right. Supports [list lookups](#eql-syntax-lookup-operators). Can only be used to compare strings. For case-insensitive matching, use `like~`.
|
: Returns `true` if the string to the left of the keyword matches a [wildcard pattern](#eql-syntax-wildcards) to the right. Supports [list lookups](#eql-syntax-lookup-operators). Can only be used to compare strings. For case-insensitive matching, use `like~`.
|
||||||
|
|
||||||
`regex` (case-sensitive)
|
`regex` (case-sensitive)
|
||||||
: Returns `true` if the string to the left of the keyword matches a regular expression to the right. For supported regular expression syntax, see [*Regular expression syntax*](/reference/query-languages/regexp-syntax.md). Supports [list lookups](#eql-syntax-lookup-operators). Can only be used to compare strings. For case-insensitive matching, use `regex~`.
|
: Returns `true` if the string to the left of the keyword matches a regular expression to the right. For supported regular expression syntax, see [*Regular expression syntax*](/reference/query-languages/query-dsl/regexp-syntax.md). Supports [list lookups](#eql-syntax-lookup-operators). Can only be used to compare strings. For case-insensitive matching, use `regex~`.
|
||||||
|
|
||||||
|
|
||||||
#### Limitations for comparisons [limitations-for-comparisons]
|
#### Limitations for comparisons [limitations-for-comparisons]
|
||||||
|
@ -201,7 +201,7 @@ my_field regex~ ("value-[0-9]", "value[^2].?", "val3") // case-insensitive
|
||||||
: Returns `true` if the string matches a [wildcard pattern](#eql-syntax-wildcards) in the provided list. Can only be used to compare strings. For case-insensitive matching, use `like~`.
|
: Returns `true` if the string matches a [wildcard pattern](#eql-syntax-wildcards) in the provided list. Can only be used to compare strings. For case-insensitive matching, use `like~`.
|
||||||
|
|
||||||
`regex` (case-sensitive)
|
`regex` (case-sensitive)
|
||||||
: Returns `true` if the string matches a regular expression pattern in the provided list. For supported regular expression syntax, see [*Regular expression syntax*](/reference/query-languages/regexp-syntax.md). Can only be used to compare strings. For case-insensitive matching, use `regex~`.
|
: Returns `true` if the string matches a regular expression pattern in the provided list. For supported regular expression syntax, see [*Regular expression syntax*](/reference/query-languages/query-dsl/regexp-syntax.md). Can only be used to compare strings. For case-insensitive matching, use `regex~`.
|
||||||
|
|
||||||
|
|
||||||
### Math operators [eql-syntax-math-operators]
|
### Math operators [eql-syntax-math-operators]
|
||||||
|
@ -653,7 +653,7 @@ Sample queries do not take into account the chronological ordering of events. Th
|
||||||
|
|
||||||
## Functions [eql-functions]
|
## Functions [eql-functions]
|
||||||
|
|
||||||
You can use EQL functions to convert data types, perform math, manipulate strings, and more. For a list of supported functions, see [Function reference](/reference/query-languages/eql-function-ref.md).
|
You can use EQL functions to convert data types, perform math, manipulate strings, and more. For a list of supported functions, see [Function reference](/reference/query-languages/eql/eql-function-ref.md).
|
||||||
|
|
||||||
|
|
||||||
### Case-insensitive functions [eql-case-insensitive-functions]
|
### Case-insensitive functions [eql-case-insensitive-functions]
|
||||||
|
@ -712,7 +712,7 @@ authentication where agent.id == 4624
|
||||||
|
|
||||||
You can pass the output of a pipe to another pipe. This lets you use multiple pipes with a single query.
|
You can pass the output of a pipe to another pipe. This lets you use multiple pipes with a single query.
|
||||||
|
|
||||||
For a list of supported pipes, see [Pipe reference](/reference/query-languages/eql-pipe-ref.md).
|
For a list of supported pipes, see [Pipe reference](/reference/query-languages/eql/eql-pipe-ref.md).
|
||||||
|
|
||||||
|
|
||||||
## Limitations [eql-syntax-limitations]
|
## Limitations [eql-syntax-limitations]
|
||||||
|
@ -831,13 +831,13 @@ The query’s event items correspond to the following states:
|
||||||
* State B: `[process where process.name == "bash"]`
|
* State B: `[process where process.name == "bash"]`
|
||||||
* Complete: `[process where process.name == "cat"]`
|
* Complete: `[process where process.name == "cat"]`
|
||||||
|
|
||||||
:::{image} ../../images/sequence-state-machine.svg
|
:::{image} /images/sequence-state-machine.svg
|
||||||
:alt: sequence state machine
|
:alt: sequence state machine
|
||||||
:::
|
:::
|
||||||
|
|
||||||
To find matching sequences, the query uses separate state machines for each unique `user.name` value. Based on the data set, you can expect two state machines: one for the `root` user and one for `elkbee`.
|
To find matching sequences, the query uses separate state machines for each unique `user.name` value. Based on the data set, you can expect two state machines: one for the `root` user and one for `elkbee`.
|
||||||
|
|
||||||
:::{image} ../../images/separate-state-machines.svg
|
:::{image} /images/separate-state-machines.svg
|
||||||
:alt: separate state machines
|
:alt: separate state machines
|
||||||
:::
|
:::
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
**Description**
|
**Description**
|
||||||
|
|
||||||
Use `MATCH` to perform a [match query](/reference/query-languages/query-dsl-match-query.md) on the specified field. Using `MATCH` is equivalent to using the `match` query in the Elasticsearch Query DSL. Match can be used on fields from the text family like [text](/reference/elasticsearch/mapping-reference/text.md) and [semantic_text](/reference/elasticsearch/mapping-reference/semantic-text.md), as well as other field types like keyword, boolean, dates, and numeric types. Match can use [function named parameters](/reference/query-languages/esql/esql-syntax.md#esql-function-named-params) to specify additional options for the match query. All [match query parameters](/reference/query-languages/query-dsl-match-query.md#match-field-params) are supported. For a simplified syntax, you can use the [match operator](/reference/query-languages/esql/esql-functions-operators.md#esql-search-operators) `:` operator instead of `MATCH`. `MATCH` returns true if the provided query matches the row.
|
Use `MATCH` to perform a [match query](/reference/query-languages/query-dsl/query-dsl-match-query.md) on the specified field. Using `MATCH` is equivalent to using the `match` query in the Elasticsearch Query DSL. Match can be used on fields from the text family like [text](/reference/elasticsearch/mapping-reference/text.md) and [semantic_text](/reference/elasticsearch/mapping-reference/semantic-text.md), as well as other field types like keyword, boolean, dates, and numeric types. Match can use [function named parameters](/reference/query-languages/esql/esql-syntax.md#esql-function-named-params) to specify additional options for the match query. All [match query parameters](/reference/query-languages/query-dsl/query-dsl-match-query.md#match-field-params) are supported. For a simplified syntax, you can use the [match operator](/reference/query-languages/esql/esql-functions-operators.md#esql-search-operators) `:` operator instead of `MATCH`. `MATCH` returns true if the provided query matches the row.
|
||||||
|
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
**Description**
|
**Description**
|
||||||
|
|
||||||
Performs a [query string query](/reference/query-languages/query-dsl-query-string-query.md). Returns true if the provided query string matches the row.
|
Performs a [query string query](/reference/query-languages/query-dsl/query-dsl-query-string-query.md). Returns true if the provided query string matches the row.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
% This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
|
% This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
|
||||||
|
|
||||||
**Example**
|
**Examples**
|
||||||
|
|
||||||
```esql
|
```esql
|
||||||
ROW message = "Some Text"
|
ROW message = "Some Text"
|
||||||
|
@ -11,4 +11,12 @@ ROW message = "Some Text"
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| Some Text | some text |
|
| Some Text | some text |
|
||||||
|
|
||||||
|
```esql
|
||||||
|
ROW v = TO_LOWER(["Some", "Text"])
|
||||||
|
```
|
||||||
|
|
||||||
|
| v:keyword |
|
||||||
|
| --- |
|
||||||
|
| ["some", "text"] |
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
: Value to find in the provided field.
|
: Value to find in the provided field.
|
||||||
|
|
||||||
`options`
|
`options`
|
||||||
: (Optional) Match additional options as [function named parameters](/reference/query-languages/esql/esql-syntax.md#esql-function-named-params). See [match query](/reference/query-languages/query-dsl-match-query.md) for more information.
|
: (Optional) Match additional options as [function named parameters](/reference/query-languages/esql/esql-syntax.md#esql-function-named-params). See [match query](/reference/query-languages/query-dsl/query-dsl-match-query.md) for more information.
|
||||||
|
|
||||||
|
|
|
@ -6,5 +6,5 @@
|
||||||
: Query string in Lucene query string format.
|
: Query string in Lucene query string format.
|
||||||
|
|
||||||
`options`
|
`options`
|
||||||
: (Optional) Additional options for Query String as [function named parameters](/reference/query-languages/esql/esql-syntax.md#esql-function-named-params). See [query string query](/reference/query-languages/query-dsl-query-string-query.md) for more information.
|
: (Optional) Additional options for Query String as [function named parameters](/reference/query-languages/esql/esql-syntax.md#esql-function-named-params). See [query string query](/reference/query-languages/query-dsl/query-dsl-query-string-query.md) for more information.
|
||||||
|
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
`str`
|
`str`
|
||||||
: String expression. If `null`, the function returns `null`.
|
: String expression. If `null`, the function returns `null`. The input can be a single- or multi-valued column or an expression.
|
||||||
|
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
`str`
|
`str`
|
||||||
: String expression. If `null`, the function returns `null`.
|
: String expression. If `null`, the function returns `null`. The input can be a single- or multi-valued column or an expression.
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,11 @@ Do not use on production environments. This functionality is in technical previe
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
||||||
The match operator performs a [match query](/reference/query-languages/query-dsl-match-query.md) on the specified field. Returns true if the provided query matches the row.
|
The match operator performs a [match query](/reference/query-languages/query-dsl/query-dsl-match-query.md) on the specified field. Returns true if the provided query matches the row.
|
||||||
|
|
||||||
The match operator is equivalent to the [match function](../../../esql-functions-operators.md#esql-match).
|
The match operator is equivalent to the [match function](../../../esql-functions-operators.md#esql-match).
|
||||||
|
|
||||||
For using the function syntax, or adding [match query parameters](/reference/query-languages/query-dsl-match-query.md#match-field-params), you can use the [match function](../../../esql-functions-operators.md#esql-match).
|
For using the function syntax, or adding [match query parameters](/reference/query-languages/query-dsl/query-dsl-match-query.md#match-field-params), you can use the [match function](../../../esql-functions-operators.md#esql-match).
|
||||||
|
|
||||||
|
|
||||||
:::{include} ../types/match_operator.md
|
:::{include} ../types/match_operator.md
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## `RLIKE` [esql-rlike]
|
## `RLIKE` [esql-rlike]
|
||||||
|
|
||||||
Use `RLIKE` to filter data based on string patterns using using [regular expressions](/reference/query-languages/regexp-syntax.md). `RLIKE` usually acts on a field placed on the left-hand side of the operator, but it can also act on a constant (literal) expression. The right-hand side of the operator represents the pattern.
|
Use `RLIKE` to filter data based on string patterns using using [regular expressions](/reference/query-languages/query-dsl/regexp-syntax.md). `RLIKE` usually acts on a field placed on the left-hand side of the operator, but it can also act on a constant (literal) expression. The right-hand side of the operator represents the pattern.
|
||||||
|
|
||||||
|
|
||||||
:::{include} ../types/rlike.md
|
:::{include} ../types/rlike.md
|
||||||
|
|
|
@ -1200,7 +1200,7 @@ FROM employees
|
||||||
|
|
||||||
For matching text, you can use [full text search functions](/reference/query-languages/esql/esql-functions-operators.md#esql-search-functions) like `MATCH`.
|
For matching text, you can use [full text search functions](/reference/query-languages/esql/esql-functions-operators.md#esql-search-functions) like `MATCH`.
|
||||||
|
|
||||||
Use [`MATCH`](/reference/query-languages/esql/esql-functions-operators.md#esql-match) to perform a [match query](/reference/query-languages/query-dsl-match-query.md) on a specified field.
|
Use [`MATCH`](/reference/query-languages/esql/esql-functions-operators.md#esql-match) to perform a [match query](/reference/query-languages/query-dsl/query-dsl-match-query.md) on a specified field.
|
||||||
|
|
||||||
Match can be used on text fields, as well as other field types like boolean, dates, and numeric types.
|
Match can be used on text fields, as well as other field types like boolean, dates, and numeric types.
|
||||||
|
|
||||||
|
@ -1265,7 +1265,7 @@ ROW message = "foo * bar"
|
||||||
| WHERE message LIKE """foo \* bar"""
|
| WHERE message LIKE """foo \* bar"""
|
||||||
```
|
```
|
||||||
|
|
||||||
Use `RLIKE` to filter data based on string patterns using using [regular expressions](/reference/query-languages/regexp-syntax.md). `RLIKE` usually acts on a field placed on the left-hand side of the operator, but it can also act on a constant (literal) expression. The right-hand side of the operator represents the pattern.
|
Use `RLIKE` to filter data based on string patterns using using [regular expressions](/reference/query-languages/query-dsl/regexp-syntax.md). `RLIKE` usually acts on a field placed on the left-hand side of the operator, but it can also act on a constant (literal) expression. The right-hand side of the operator represents the pattern.
|
||||||
|
|
||||||
**Supported types**
|
**Supported types**
|
||||||
|
|
||||||
|
|
|
@ -205,13 +205,13 @@ Once created, you can’t update or change an enrich policy. Instead, you can:
|
||||||
The {{esql}} `ENRICH` command supports all three enrich policy types:
|
The {{esql}} `ENRICH` command supports all three enrich policy types:
|
||||||
|
|
||||||
`geo_match`
|
`geo_match`
|
||||||
: Matches enrich data to incoming documents based on a [`geo_shape` query](/reference/query-languages/query-dsl-geo-shape-query.md). For an example, see [Example: Enrich your data based on geolocation](docs-content://manage-data/ingest/transform-enrich/example-enrich-data-based-on-geolocation.md).
|
: Matches enrich data to incoming documents based on a [`geo_shape` query](/reference/query-languages/query-dsl/query-dsl-geo-shape-query.md). For an example, see [Example: Enrich your data based on geolocation](docs-content://manage-data/ingest/transform-enrich/example-enrich-data-based-on-geolocation.md).
|
||||||
|
|
||||||
`match`
|
`match`
|
||||||
: Matches enrich data to incoming documents based on a [`term` query](/reference/query-languages/query-dsl-term-query.md). For an example, see [Example: Enrich your data based on exact values](docs-content://manage-data/ingest/transform-enrich/example-enrich-data-based-on-exact-values.md).
|
: Matches enrich data to incoming documents based on a [`term` query](/reference/query-languages/query-dsl/query-dsl-term-query.md). For an example, see [Example: Enrich your data based on exact values](docs-content://manage-data/ingest/transform-enrich/example-enrich-data-based-on-exact-values.md).
|
||||||
|
|
||||||
`range`
|
`range`
|
||||||
: Matches a number, date, or IP address in incoming documents to a range in the enrich index based on a [`term` query](/reference/query-languages/query-dsl-term-query.md). For an example, see [Example: Enrich your data by matching a value to a range](docs-content://manage-data/ingest/transform-enrich/example-enrich-data-by-matching-value-to-range.md).
|
: Matches a number, date, or IP address in incoming documents to a range in the enrich index based on a [`term` query](/reference/query-languages/query-dsl/query-dsl-term-query.md). For an example, see [Example: Enrich your data by matching a value to a range](docs-content://manage-data/ingest/transform-enrich/example-enrich-data-by-matching-value-to-range.md).
|
||||||
|
|
||||||
While all three enrich policy types are supported, there are some limitations to be aware of:
|
While all three enrich policy types are supported, there are some limitations to be aware of:
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
"name" : "str",
|
"name" : "str",
|
||||||
"type" : "keyword",
|
"type" : "keyword",
|
||||||
"optional" : false,
|
"optional" : false,
|
||||||
"description" : "String expression. If `null`, the function returns `null`."
|
"description" : "String expression. If `null`, the function returns `null`. The input can be a single- or multi-valued column or an expression."
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"variadic" : false,
|
"variadic" : false,
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
"name" : "str",
|
"name" : "str",
|
||||||
"type" : "text",
|
"type" : "text",
|
||||||
"optional" : false,
|
"optional" : false,
|
||||||
"description" : "String expression. If `null`, the function returns `null`."
|
"description" : "String expression. If `null`, the function returns `null`. The input can be a single- or multi-valued column or an expression."
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"variadic" : false,
|
"variadic" : false,
|
||||||
|
@ -30,7 +30,8 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"examples" : [
|
"examples" : [
|
||||||
"ROW message = \"Some Text\"\n| EVAL message_lower = TO_LOWER(message)"
|
"ROW message = \"Some Text\"\n| EVAL message_lower = TO_LOWER(message)",
|
||||||
|
"ROW v = TO_LOWER([\"Some\", \"Text\"])"
|
||||||
],
|
],
|
||||||
"preview" : false,
|
"preview" : false,
|
||||||
"snapshot_only" : false
|
"snapshot_only" : false
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
"name" : "str",
|
"name" : "str",
|
||||||
"type" : "keyword",
|
"type" : "keyword",
|
||||||
"optional" : false,
|
"optional" : false,
|
||||||
"description" : "String expression. If `null`, the function returns `null`."
|
"description" : "String expression. If `null`, the function returns `null`. The input can be a single- or multi-valued column or an expression."
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"variadic" : false,
|
"variadic" : false,
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
"name" : "str",
|
"name" : "str",
|
||||||
"type" : "text",
|
"type" : "text",
|
||||||
"optional" : false,
|
"optional" : false,
|
||||||
"description" : "String expression. If `null`, the function returns `null`."
|
"description" : "String expression. If `null`, the function returns `null`. The input can be a single- or multi-valued column or an expression."
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"variadic" : false,
|
"variadic" : false,
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
---
|
|
||||||
navigation_title: "Constant score"
|
|
||||||
mapped_pages:
|
|
||||||
- https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-constant-score-query.html
|
|
||||||
---
|
|
||||||
|
|
||||||
# Constant score query [query-dsl-constant-score-query]
|
|
||||||
|
|
||||||
|
|
||||||
Wraps a [filter query](/reference/query-languages/query-dsl-bool-query.md) and returns every matching document with a [relevance score](/reference/query-languages/query-filter-context.md#relevance-scores) equal to the `boost` parameter value.
|
|
||||||
|
|
||||||
```console
|
|
||||||
GET /_search
|
|
||||||
{
|
|
||||||
"query": {
|
|
||||||
"constant_score": {
|
|
||||||
"filter": {
|
|
||||||
"term": { "user.id": "kimchy" }
|
|
||||||
},
|
|
||||||
"boost": 1.2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Top-level parameters for `constant_score` [constant-score-top-level-params]
|
|
||||||
|
|
||||||
`filter`
|
|
||||||
: (Required, query object) [Filter query](/reference/query-languages/query-dsl-bool-query.md) you wish to run. Any returned documents must match this query.
|
|
||||||
|
|
||||||
Filter queries do not calculate [relevance scores](/reference/query-languages/query-filter-context.md#relevance-scores). To speed up performance, {{es}} automatically caches frequently used filter queries.
|
|
||||||
|
|
||||||
|
|
||||||
`boost`
|
|
||||||
: (Optional, float) Floating point number used as the constant [relevance score](/reference/query-languages/query-filter-context.md#relevance-scores) for every document matching the `filter` query. Defaults to `1.0`.
|
|
||||||
|
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
---
|
|
||||||
navigation_title: "Match boolean prefix"
|
|
||||||
mapped_pages:
|
|
||||||
- https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-bool-prefix-query.html
|
|
||||||
---
|
|
||||||
|
|
||||||
# Match boolean prefix query [query-dsl-match-bool-prefix-query]
|
|
||||||
|
|
||||||
|
|
||||||
A `match_bool_prefix` query analyzes its input and constructs a [`bool` query](/reference/query-languages/query-dsl-bool-query.md) from the terms. Each term except the last is used in a `term` query. The last term is used in a `prefix` query. A `match_bool_prefix` query such as
|
|
||||||
|
|
||||||
```console
|
|
||||||
GET /_search
|
|
||||||
{
|
|
||||||
"query": {
|
|
||||||
"match_bool_prefix" : {
|
|
||||||
"message" : "quick brown f"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
where analysis produces the terms `quick`, `brown`, and `f` is similar to the following `bool` query
|
|
||||||
|
|
||||||
```console
|
|
||||||
GET /_search
|
|
||||||
{
|
|
||||||
"query": {
|
|
||||||
"bool" : {
|
|
||||||
"should": [
|
|
||||||
{ "term": { "message": "quick" }},
|
|
||||||
{ "term": { "message": "brown" }},
|
|
||||||
{ "prefix": { "message": "f"}}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
An important difference between the `match_bool_prefix` query and [`match_phrase_prefix`](/reference/query-languages/query-dsl-match-query-phrase-prefix.md) is that the `match_phrase_prefix` query matches its terms as a phrase, but the `match_bool_prefix` query can match its terms in any position. The example `match_bool_prefix` query above could match a field containing `quick brown fox`, but it could also match `brown fox quick`. It could also match a field containing the term `quick`, the term `brown` and a term starting with `f`, appearing in any position.
|
|
||||||
|
|
||||||
## Parameters [_parameters]
|
|
||||||
|
|
||||||
By default, `match_bool_prefix` queries' input text will be analyzed using the analyzer from the queried field’s mapping. A different search analyzer can be configured with the `analyzer` parameter
|
|
||||||
|
|
||||||
```console
|
|
||||||
GET /_search
|
|
||||||
{
|
|
||||||
"query": {
|
|
||||||
"match_bool_prefix": {
|
|
||||||
"message": {
|
|
||||||
"query": "quick brown f",
|
|
||||||
"analyzer": "keyword"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
`match_bool_prefix` queries support the [`minimum_should_match`](/reference/query-languages/query-dsl-minimum-should-match.md) and `operator` parameters as described for the [`match` query](/reference/query-languages/query-dsl-match-query.md#query-dsl-match-query-boolean), applying the setting to the constructed `bool` query. The number of clauses in the constructed `bool` query will in most cases be the number of terms produced by analysis of the query text.
|
|
||||||
|
|
||||||
The [`fuzziness`](/reference/query-languages/query-dsl-match-query.md#query-dsl-match-query-fuzziness), `prefix_length`, `max_expansions`, `fuzzy_transpositions`, and `fuzzy_rewrite` parameters can be applied to the `term` subqueries constructed for all terms but the final term. They do not have any effect on the prefix query constructed for the final term.
|
|
||||||
|
|
||||||
|
|
|
@ -9,19 +9,19 @@ Compound queries wrap other compound or leaf queries, either to combine their re
|
||||||
|
|
||||||
The queries in this group are:
|
The queries in this group are:
|
||||||
|
|
||||||
[`bool` query](/reference/query-languages/query-dsl-bool-query.md)
|
[`bool` query](/reference/query-languages/query-dsl/query-dsl-bool-query.md)
|
||||||
: The default query for combining multiple leaf or compound query clauses, as `must`, `should`, `must_not`, or `filter` clauses. The `must` and `should` clauses have their scores combined — the more matching clauses, the better — while the `must_not` and `filter` clauses are executed in filter context.
|
: The default query for combining multiple leaf or compound query clauses, as `must`, `should`, `must_not`, or `filter` clauses. The `must` and `should` clauses have their scores combined — the more matching clauses, the better — while the `must_not` and `filter` clauses are executed in filter context.
|
||||||
|
|
||||||
[`boosting` query](/reference/query-languages/query-dsl-boosting-query.md)
|
[`boosting` query](/reference/query-languages/query-dsl/query-dsl-boosting-query.md)
|
||||||
: Return documents which match a `positive` query, but reduce the score of documents which also match a `negative` query.
|
: Return documents which match a `positive` query, but reduce the score of documents which also match a `negative` query.
|
||||||
|
|
||||||
[`constant_score` query](/reference/query-languages/query-dsl-constant-score-query.md)
|
[`constant_score` query](/reference/query-languages/query-dsl/query-dsl-constant-score-query.md)
|
||||||
: A query which wraps another query, but executes it in filter context. All matching documents are given the same constant `_score`.
|
: A query which wraps another query, but executes it in filter context. All matching documents are given the same constant `_score`.
|
||||||
|
|
||||||
[`dis_max` query](/reference/query-languages/query-dsl-dis-max-query.md)
|
[`dis_max` query](/reference/query-languages/query-dsl/query-dsl-dis-max-query.md)
|
||||||
: A query which accepts multiple queries, and returns any documents which match any of the query clauses. While the `bool` query combines the scores from all matching queries, the `dis_max` query uses the score of the single best- matching query clause.
|
: A query which accepts multiple queries, and returns any documents which match any of the query clauses. While the `bool` query combines the scores from all matching queries, the `dis_max` query uses the score of the single best- matching query clause.
|
||||||
|
|
||||||
[`function_score` query](/reference/query-languages/query-dsl-function-score-query.md)
|
[`function_score` query](/reference/query-languages/query-dsl/query-dsl-function-score-query.md)
|
||||||
: Modify the scores returned by the main query with functions to take into account factors like popularity, recency, distance, or custom algorithms implemented with scripting.
|
: Modify the scores returned by the main query with functions to take into account factors like popularity, recency, distance, or custom algorithms implemented with scripting.
|
||||||
|
|
||||||
|
|
|
@ -9,31 +9,31 @@ The full text queries enable you to search [analyzed text fields](docs-content:/
|
||||||
|
|
||||||
The queries in this group are:
|
The queries in this group are:
|
||||||
|
|
||||||
[`intervals` query](/reference/query-languages/query-dsl-intervals-query.md)
|
[`intervals` query](/reference/query-languages/query-dsl/query-dsl-intervals-query.md)
|
||||||
: A full text query that allows fine-grained control of the ordering and proximity of matching terms.
|
: A full text query that allows fine-grained control of the ordering and proximity of matching terms.
|
||||||
|
|
||||||
[`match` query](/reference/query-languages/query-dsl-match-query.md)
|
[`match` query](/reference/query-languages/query-dsl/query-dsl-match-query.md)
|
||||||
: The standard query for performing full text queries, including fuzzy matching and phrase or proximity queries.
|
: The standard query for performing full text queries, including fuzzy matching and phrase or proximity queries.
|
||||||
|
|
||||||
[`match_bool_prefix` query](/reference/query-languages/query-dsl-match-bool-prefix-query.md)
|
[`match_bool_prefix` query](/reference/query-languages/query-dsl/query-dsl-match-bool-prefix-query.md)
|
||||||
: Creates a `bool` query that matches each term as a `term` query, except for the last term, which is matched as a `prefix` query
|
: Creates a `bool` query that matches each term as a `term` query, except for the last term, which is matched as a `prefix` query
|
||||||
|
|
||||||
[`match_phrase` query](/reference/query-languages/query-dsl-match-query-phrase.md)
|
[`match_phrase` query](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md)
|
||||||
: Like the `match` query but used for matching exact phrases or word proximity matches.
|
: Like the `match` query but used for matching exact phrases or word proximity matches.
|
||||||
|
|
||||||
[`match_phrase_prefix` query](/reference/query-languages/query-dsl-match-query-phrase-prefix.md)
|
[`match_phrase_prefix` query](/reference/query-languages/query-dsl/query-dsl-match-query-phrase-prefix.md)
|
||||||
: Like the `match_phrase` query, but does a wildcard search on the final word.
|
: Like the `match_phrase` query, but does a wildcard search on the final word.
|
||||||
|
|
||||||
[`multi_match` query](/reference/query-languages/query-dsl-multi-match-query.md)
|
[`multi_match` query](/reference/query-languages/query-dsl/query-dsl-multi-match-query.md)
|
||||||
: The multi-field version of the `match` query.
|
: The multi-field version of the `match` query.
|
||||||
|
|
||||||
[`combined_fields` query](/reference/query-languages/query-dsl-combined-fields-query.md)
|
[`combined_fields` query](/reference/query-languages/query-dsl/query-dsl-combined-fields-query.md)
|
||||||
: Matches over multiple fields as if they had been indexed into one combined field.
|
: Matches over multiple fields as if they had been indexed into one combined field.
|
||||||
|
|
||||||
[`query_string` query](/reference/query-languages/query-dsl-query-string-query.md)
|
[`query_string` query](/reference/query-languages/query-dsl/query-dsl-query-string-query.md)
|
||||||
: Supports the compact Lucene [query string syntax](/reference/query-languages/query-dsl-query-string-query.md#query-string-syntax), allowing you to specify AND|OR|NOT conditions and multi-field search within a single query string. For expert users only.
|
: Supports the compact Lucene [query string syntax](/reference/query-languages/query-dsl/query-dsl-query-string-query.md#query-string-syntax), allowing you to specify AND|OR|NOT conditions and multi-field search within a single query string. For expert users only.
|
||||||
|
|
||||||
[`simple_query_string` query](/reference/query-languages/query-dsl-simple-query-string-query.md)
|
[`simple_query_string` query](/reference/query-languages/query-dsl/query-dsl-simple-query-string-query.md)
|
||||||
: A simpler, more robust version of the `query_string` syntax suitable for exposing directly to users.
|
: A simpler, more robust version of the `query_string` syntax suitable for exposing directly to users.
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,13 @@ Elasticsearch supports two types of geo data: [`geo_point`](/reference/elasticse
|
||||||
|
|
||||||
The queries in this group are:
|
The queries in this group are:
|
||||||
|
|
||||||
[`geo_bounding_box`](/reference/query-languages/query-dsl-geo-bounding-box-query.md) query
|
[`geo_bounding_box`](/reference/query-languages/query-dsl/query-dsl-geo-bounding-box-query.md) query
|
||||||
: Finds documents with geoshapes or geopoints which intersect the specified rectangle.
|
: Finds documents with geoshapes or geopoints which intersect the specified rectangle.
|
||||||
|
|
||||||
[`geo_distance`](/reference/query-languages/query-dsl-geo-distance-query.md) query
|
[`geo_distance`](/reference/query-languages/query-dsl/query-dsl-geo-distance-query.md) query
|
||||||
: Finds documents with geoshapes or geopoints within the specified distance of a central point.
|
: Finds documents with geoshapes or geopoints within the specified distance of a central point.
|
||||||
|
|
||||||
[`geo_grid`](/reference/query-languages/query-dsl-geo-grid-query.md) query
|
[`geo_grid`](/reference/query-languages/query-dsl/query-dsl-geo-grid-query.md) query
|
||||||
: Finds documents with:
|
: Finds documents with:
|
||||||
|
|
||||||
* Geoshapes or geopoints which intersect the specified geohash
|
* Geoshapes or geopoints which intersect the specified geohash
|
||||||
|
@ -23,10 +23,10 @@ The queries in this group are:
|
||||||
* Geopoints which intersect the specified H3 bin
|
* Geopoints which intersect the specified H3 bin
|
||||||
|
|
||||||
|
|
||||||
[`geo_polygon`](/reference/query-languages/query-dsl-geo-polygon-query.md) query
|
[`geo_polygon`](/reference/query-languages/query-dsl/query-dsl-geo-polygon-query.md) query
|
||||||
: Find documents with geoshapes or geopoints which intersect the specified polygon.
|
: Find documents with geoshapes or geopoints which intersect the specified polygon.
|
||||||
|
|
||||||
[`geo_shape`](/reference/query-languages/query-dsl-geo-shape-query.md) query
|
[`geo_shape`](/reference/query-languages/query-dsl/query-dsl-geo-shape-query.md) query
|
||||||
: Finds documents with geoshapes or geopoints which are related to the specified geoshape. Possible spatial relationships to specify are: intersects, contained, within and disjoint.
|
: Finds documents with geoshapes or geopoints which are related to the specified geoshape. Possible spatial relationships to specify are: intersects, contained, within and disjoint.
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,13 @@ mapped_pages:
|
||||||
|
|
||||||
Performing full SQL-style joins in a distributed system like Elasticsearch is prohibitively expensive. Instead, Elasticsearch offers two forms of join which are designed to scale horizontally.
|
Performing full SQL-style joins in a distributed system like Elasticsearch is prohibitively expensive. Instead, Elasticsearch offers two forms of join which are designed to scale horizontally.
|
||||||
|
|
||||||
[`nested` query](/reference/query-languages/query-dsl-nested-query.md)
|
[`nested` query](/reference/query-languages/query-dsl/query-dsl-nested-query.md)
|
||||||
: Documents may contain fields of type [`nested`](/reference/elasticsearch/mapping-reference/nested.md). These fields are used to index arrays of objects, where each object can be queried (with the `nested` query) as an independent document.
|
: Documents may contain fields of type [`nested`](/reference/elasticsearch/mapping-reference/nested.md). These fields are used to index arrays of objects, where each object can be queried (with the `nested` query) as an independent document.
|
||||||
|
|
||||||
[`has_child`](/reference/query-languages/query-dsl-has-child-query.md) and [`has_parent`](/reference/query-languages/query-dsl-has-parent-query.md) queries
|
[`has_child`](/reference/query-languages/query-dsl/query-dsl-has-child-query.md) and [`has_parent`](/reference/query-languages/query-dsl/query-dsl-has-parent-query.md) queries
|
||||||
: A [`join` field relationship](/reference/elasticsearch/mapping-reference/parent-join.md) can exist between documents within a single index. The `has_child` query returns parent documents whose child documents match the specified query, while the `has_parent` query returns child documents whose parent document matches the specified query.
|
: A [`join` field relationship](/reference/elasticsearch/mapping-reference/parent-join.md) can exist between documents within a single index. The `has_child` query returns parent documents whose child documents match the specified query, while the `has_parent` query returns child documents whose parent document matches the specified query.
|
||||||
|
|
||||||
Also see the [terms-lookup mechanism](/reference/query-languages/query-dsl-terms-query.md#query-dsl-terms-lookup) in the `terms` query, which allows you to build a `terms` query from values contained in another document.
|
Also see the [terms-lookup mechanism](/reference/query-languages/query-dsl/query-dsl-terms-query.md#query-dsl-terms-lookup) in the `terms` query, which allows you to build a `terms` query from values contained in another document.
|
||||||
|
|
||||||
|
|
||||||
## Notes [joining-queries-notes]
|
## Notes [joining-queries-notes]
|
|
@ -13,8 +13,8 @@ A query that matches documents matching boolean combinations of other queries. T
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `must` | The clause (query) must appear in matching documents and willcontribute to the score. Each query defined under a `must` acts as a logical "AND", returning only documents that match *all* the specified queries. |
|
| `must` | The clause (query) must appear in matching documents and willcontribute to the score. Each query defined under a `must` acts as a logical "AND", returning only documents that match *all* the specified queries. |
|
||||||
| `should` | The clause (query) should appear in the matching document. Each query defined under a `should` acts as a logical "OR", returning documents that match *any* of the specified queries. |
|
| `should` | The clause (query) should appear in the matching document. Each query defined under a `should` acts as a logical "OR", returning documents that match *any* of the specified queries. |
|
||||||
| `filter` | The clause (query) must appear in matching documents. However unlike`must` the score of the query will be ignored. Filter clauses are executedin [filter context](/reference/query-languages/query-filter-context.md), meaning that scoring is ignoredand clauses are considered for caching. Each query defined under a `filter` acts as a logical "AND", returning only documents that match *all* the specified queries. |
|
| `filter` | The clause (query) must appear in matching documents. However unlike`must` the score of the query will be ignored. Filter clauses are executedin [filter context](/reference/query-languages/query-dsl/query-filter-context.md), meaning that scoring is ignoredand clauses are considered for caching. Each query defined under a `filter` acts as a logical "AND", returning only documents that match *all* the specified queries. |
|
||||||
| `must_not` | The clause (query) must not appear in the matchingdocuments. Clauses are executed in [filter context](/reference/query-languages/query-filter-context.md) meaningthat scoring is ignored and clauses are considered for caching. Because scoring isignored, a score of `0` for all documents is returned. Each query defined under a `must_not` acts as a logical "NOT", returning only documents that do not match any of the specified queries. |
|
| `must_not` | The clause (query) must not appear in the matchingdocuments. Clauses are executed in [filter context](/reference/query-languages/query-dsl/query-filter-context.md) meaningthat scoring is ignored and clauses are considered for caching. Because scoring isignored, a score of `0` for all documents is returned. Each query defined under a `must_not` acts as a logical "NOT", returning only documents that do not match any of the specified queries. |
|
||||||
|
|
||||||
The `must` and `should` clauses function as logical AND, OR operators, contributing to the scoring of results. However, these results will not be cached for faster retrieval. In contrast, the `filter` and `must_not` clauses are used to include or exclude results without impacting the score, unless used within a `constant_score` query.
|
The `must` and `should` clauses function as logical AND, OR operators, contributing to the scoring of results. However, these results will not be cached for faster retrieval. In contrast, the `filter` and `must_not` clauses are used to include or exclude results without impacting the score, unless used within a `constant_score` query.
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ You can use the `minimum_should_match` parameter to specify the number or percen
|
||||||
|
|
||||||
If the `bool` query includes at least one `should` clause and no `must` or `filter` clauses, the default value is `1`. Otherwise, the default value is `0`.
|
If the `bool` query includes at least one `should` clause and no `must` or `filter` clauses, the default value is `1`. Otherwise, the default value is `0`.
|
||||||
|
|
||||||
For other valid values, see the [`minimum_should_match` parameter](/reference/query-languages/query-dsl-minimum-should-match.md).
|
For other valid values, see the [`minimum_should_match` parameter](/reference/query-languages/query-dsl/query-dsl-minimum-should-match.md).
|
||||||
|
|
||||||
|
|
||||||
## Scoring with `bool.filter` [score-bool-filter]
|
## Scoring with `bool.filter` [score-bool-filter]
|
|
@ -7,7 +7,7 @@ mapped_pages:
|
||||||
# Boosting query [query-dsl-boosting-query]
|
# Boosting query [query-dsl-boosting-query]
|
||||||
|
|
||||||
|
|
||||||
Returns documents matching a `positive` query while reducing the [relevance score](/reference/query-languages/query-filter-context.md#relevance-scores) of documents that also match a `negative` query.
|
Returns documents matching a `positive` query while reducing the [relevance score](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores) of documents that also match a `negative` query.
|
||||||
|
|
||||||
You can use the `boosting` query to demote certain documents without excluding them from the search results.
|
You can use the `boosting` query to demote certain documents without excluding them from the search results.
|
||||||
|
|
||||||
|
@ -41,15 +41,15 @@ GET /_search
|
||||||
: (Required, query object) Query you wish to run. Any returned documents must match this query.
|
: (Required, query object) Query you wish to run. Any returned documents must match this query.
|
||||||
|
|
||||||
`negative`
|
`negative`
|
||||||
: (Required, query object) Query used to decrease the [relevance score](/reference/query-languages/query-filter-context.md#relevance-scores) of matching documents.
|
: (Required, query object) Query used to decrease the [relevance score](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores) of matching documents.
|
||||||
|
|
||||||
If a returned document matches the `positive` query and this query, the `boosting` query calculates the final [relevance score](/reference/query-languages/query-filter-context.md#relevance-scores) for the document as follows:
|
If a returned document matches the `positive` query and this query, the `boosting` query calculates the final [relevance score](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores) for the document as follows:
|
||||||
|
|
||||||
1. Take the original relevance score from the `positive` query.
|
1. Take the original relevance score from the `positive` query.
|
||||||
2. Multiply the score by the `negative_boost` value.
|
2. Multiply the score by the `negative_boost` value.
|
||||||
|
|
||||||
|
|
||||||
`negative_boost`
|
`negative_boost`
|
||||||
: (Required, float) Floating point number between `0` and `1.0` used to decrease the [relevance scores](/reference/query-languages/query-filter-context.md#relevance-scores) of documents matching the `negative` query.
|
: (Required, float) Floating point number between `0` and `1.0` used to decrease the [relevance scores](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores) of documents matching the `negative` query.
|
||||||
|
|
||||||
|
|
|
@ -69,9 +69,9 @@ The `combined_fields` query [analyzes](docs-content://manage-data/data-store/tex
|
||||||
|
|
||||||
|
|
||||||
`auto_generate_synonyms_phrase_query`
|
`auto_generate_synonyms_phrase_query`
|
||||||
: (Optional, Boolean) If `true`, [match phrase](/reference/query-languages/query-dsl-match-query-phrase.md) queries are automatically created for multi-term synonyms. Defaults to `true`.
|
: (Optional, Boolean) If `true`, [match phrase](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md) queries are automatically created for multi-term synonyms. Defaults to `true`.
|
||||||
|
|
||||||
See [Use synonyms with match query](/reference/query-languages/query-dsl-match-query.md#query-dsl-match-query-synonyms) for an example.
|
See [Use synonyms with match query](/reference/query-languages/query-dsl/query-dsl-match-query.md#query-dsl-match-query-synonyms) for an example.
|
||||||
|
|
||||||
|
|
||||||
`operator`
|
`operator`
|
||||||
|
@ -85,7 +85,7 @@ See [Use synonyms with match query](/reference/query-languages/query-dsl-match-q
|
||||||
|
|
||||||
|
|
||||||
`minimum_should_match`
|
`minimum_should_match`
|
||||||
: (Optional, string) Minimum number of clauses that must match for a document to be returned. See the [`minimum_should_match` parameter](/reference/query-languages/query-dsl-minimum-should-match.md) for valid values and more information.
|
: (Optional, string) Minimum number of clauses that must match for a document to be returned. See the [`minimum_should_match` parameter](/reference/query-languages/query-dsl/query-dsl-minimum-should-match.md) for valid values and more information.
|
||||||
|
|
||||||
|
|
||||||
`zero_terms_query`
|
`zero_terms_query`
|
||||||
|
@ -95,16 +95,16 @@ See [Use synonyms with match query](/reference/query-languages/query-dsl-match-q
|
||||||
: No documents are returned if the `analyzer` removes all tokens.
|
: No documents are returned if the `analyzer` removes all tokens.
|
||||||
|
|
||||||
`all`
|
`all`
|
||||||
: Returns all documents, similar to a [`match_all`](/reference/query-languages/query-dsl-match-all-query.md) query.
|
: Returns all documents, similar to a [`match_all`](/reference/query-languages/query-dsl/query-dsl-match-all-query.md) query.
|
||||||
|
|
||||||
See [Zero terms query](/reference/query-languages/query-dsl-match-query.md#query-dsl-match-query-zero) for an example.
|
See [Zero terms query](/reference/query-languages/query-dsl/query-dsl-match-query.md#query-dsl-match-query-zero) for an example.
|
||||||
|
|
||||||
|
|
||||||
### Comparison to `multi_match` query [_comparison_to_multi_match_query]
|
### Comparison to `multi_match` query [_comparison_to_multi_match_query]
|
||||||
|
|
||||||
The `combined_fields` query provides a principled way of matching and scoring across multiple [`text`](/reference/elasticsearch/mapping-reference/text.md) fields. To support this, it requires that all fields have the same search [`analyzer`](/reference/elasticsearch/mapping-reference/analyzer.md).
|
The `combined_fields` query provides a principled way of matching and scoring across multiple [`text`](/reference/elasticsearch/mapping-reference/text.md) fields. To support this, it requires that all fields have the same search [`analyzer`](/reference/elasticsearch/mapping-reference/analyzer.md).
|
||||||
|
|
||||||
If you want a single query that handles fields of different types like keywords or numbers, then the [`multi_match`](/reference/query-languages/query-dsl-multi-match-query.md) query may be a better fit. It supports both text and non-text fields, and accepts text fields that do not share the same analyzer.
|
If you want a single query that handles fields of different types like keywords or numbers, then the [`multi_match`](/reference/query-languages/query-dsl/query-dsl-multi-match-query.md) query may be a better fit. It supports both text and non-text fields, and accepts text fields that do not share the same analyzer.
|
||||||
|
|
||||||
The main `multi_match` modes `best_fields` and `most_fields` take a field-centric view of the query. In contrast, `combined_fields` is term-centric: `operator` and `minimum_should_match` are applied per-term, instead of per-field. Concretely, a query like
|
The main `multi_match` modes `best_fields` and `most_fields` take a field-centric view of the query. In contrast, `combined_fields` is term-centric: `operator` and `minimum_should_match` are applied per-term, instead of per-field. Concretely, a query like
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
---
|
||||||
|
navigation_title: "Constant score"
|
||||||
|
mapped_pages:
|
||||||
|
- https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-constant-score-query.html
|
||||||
|
---
|
||||||
|
|
||||||
|
# Constant score query [query-dsl-constant-score-query]
|
||||||
|
|
||||||
|
|
||||||
|
Wraps a [filter query](/reference/query-languages/query-dsl/query-dsl-bool-query.md) and returns every matching document with a [relevance score](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores) equal to the `boost` parameter value.
|
||||||
|
|
||||||
|
```console
|
||||||
|
GET /_search
|
||||||
|
{
|
||||||
|
"query": {
|
||||||
|
"constant_score": {
|
||||||
|
"filter": {
|
||||||
|
"term": { "user.id": "kimchy" }
|
||||||
|
},
|
||||||
|
"boost": 1.2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Top-level parameters for `constant_score` [constant-score-top-level-params]
|
||||||
|
|
||||||
|
`filter`
|
||||||
|
: (Required, query object) [Filter query](/reference/query-languages/query-dsl/query-dsl-bool-query.md) you wish to run. Any returned documents must match this query.
|
||||||
|
|
||||||
|
Filter queries do not calculate [relevance scores](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores). To speed up performance, {{es}} automatically caches frequently used filter queries.
|
||||||
|
|
||||||
|
|
||||||
|
`boost`
|
||||||
|
: (Optional, float) Floating point number used as the constant [relevance score](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores) for every document matching the `filter` query. Defaults to `1.0`.
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,10 @@ GET /_search
|
||||||
## Top-level parameters for `dis_max` [query-dsl-dis-max-query-top-level-params]
|
## Top-level parameters for `dis_max` [query-dsl-dis-max-query-top-level-params]
|
||||||
|
|
||||||
`queries`
|
`queries`
|
||||||
: (Required, array of query objects) Contains one or more query clauses. Returned documents **must match one or more** of these queries. If a document matches multiple queries, {{es}} uses the highest [relevance score](/reference/query-languages/query-filter-context.md).
|
: (Required, array of query objects) Contains one or more query clauses. Returned documents **must match one or more** of these queries. If a document matches multiple queries, {{es}} uses the highest [relevance score](/reference/query-languages/query-dsl/query-filter-context.md).
|
||||||
|
|
||||||
`tie_breaker`
|
`tie_breaker`
|
||||||
: (Optional, float) Floating point number between `0` and `1.0` used to increase the [relevance scores](/reference/query-languages/query-filter-context.md#relevance-scores) of documents matching multiple query clauses. Defaults to `0.0`.
|
: (Optional, float) Floating point number between `0` and `1.0` used to increase the [relevance scores](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores) of documents matching multiple query clauses. Defaults to `0.0`.
|
||||||
|
|
||||||
You can use the `tie_breaker` value to assign higher relevance scores to documents that contain the same term in multiple fields than documents that contain this term in only the best of those multiple fields, without confusing this with the better case of two different terms in the multiple fields.
|
You can use the `tie_breaker` value to assign higher relevance scores to documents that contain the same term in multiple fields than documents that contain this term in only the best of those multiple fields, without confusing this with the better case of two different terms in the multiple fields.
|
||||||
|
|
|
@ -7,9 +7,9 @@ mapped_pages:
|
||||||
# Distance feature query [query-dsl-distance-feature-query]
|
# Distance feature query [query-dsl-distance-feature-query]
|
||||||
|
|
||||||
|
|
||||||
Boosts the [relevance score](/reference/query-languages/query-filter-context.md#relevance-scores) of documents closer to a provided `origin` date or point. For example, you can use this query to give more weight to documents closer to a certain date or location.
|
Boosts the [relevance score](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores) of documents closer to a provided `origin` date or point. For example, you can use this query to give more weight to documents closer to a certain date or location.
|
||||||
|
|
||||||
You can use the `distance_feature` query to find the nearest neighbors to a location. You can also use the query in a [`bool`](/reference/query-languages/query-dsl-bool-query.md) search’s `should` filter to add boosted relevance scores to the `bool` query’s scores.
|
You can use the `distance_feature` query to find the nearest neighbors to a location. You can also use the query in a [`bool`](/reference/query-languages/query-dsl/query-dsl-bool-query.md) search’s `should` filter to add boosted relevance scores to the `bool` query’s scores.
|
||||||
|
|
||||||
## Example request [distance-feature-query-ex-request]
|
## Example request [distance-feature-query-ex-request]
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ If the `field` value is a [`geo_point`](/reference/elasticsearch/mapping-referen
|
||||||
|
|
||||||
|
|
||||||
`boost`
|
`boost`
|
||||||
: (Optional, float) Floating point number used to multiply the [relevance score](/reference/query-languages/query-filter-context.md#relevance-scores) of matching documents. This value cannot be negative. Defaults to `1.0`.
|
: (Optional, float) Floating point number used to multiply the [relevance score](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores) of matching documents. This value cannot be negative. Defaults to `1.0`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -165,9 +165,9 @@ If the `field` value is a [`geo_point`](/reference/elasticsearch/mapping-referen
|
||||||
|
|
||||||
### How the `distance_feature` query calculates relevance scores [distance-feature-calculation]
|
### How the `distance_feature` query calculates relevance scores [distance-feature-calculation]
|
||||||
|
|
||||||
The `distance_feature` query dynamically calculates the distance between the `origin` value and a document’s field values. It then uses this distance as a feature to boost the [relevance score](/reference/query-languages/query-filter-context.md#relevance-scores) of closer documents.
|
The `distance_feature` query dynamically calculates the distance between the `origin` value and a document’s field values. It then uses this distance as a feature to boost the [relevance score](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores) of closer documents.
|
||||||
|
|
||||||
The `distance_feature` query calculates a document’s [relevance score](/reference/query-languages/query-filter-context.md#relevance-scores) as follows:
|
The `distance_feature` query calculates a document’s [relevance score](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores) as follows:
|
||||||
|
|
||||||
```
|
```
|
||||||
relevance score = boost * pivot / (pivot + distance)
|
relevance score = boost * pivot / (pivot + distance)
|
||||||
|
@ -178,4 +178,4 @@ The `distance` is the absolute difference between the `origin` value and a docum
|
||||||
|
|
||||||
### Skip non-competitive hits [distance-feature-skip-hits]
|
### Skip non-competitive hits [distance-feature-skip-hits]
|
||||||
|
|
||||||
Unlike the [`function_score`](/reference/query-languages/query-dsl-function-score-query.md) query or other ways to change [relevance scores](/reference/query-languages/query-filter-context.md#relevance-scores), the `distance_feature` query efficiently skips non-competitive hits when the [`track_total_hits`](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search) parameter is **not** `true`.
|
Unlike the [`function_score`](/reference/query-languages/query-dsl/query-dsl-function-score-query.md) query or other ways to change [relevance scores](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores), the `distance_feature` query efficiently skips non-competitive hits when the [`track_total_hits`](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search) parameter is **not** `true`.
|
|
@ -47,7 +47,7 @@ GET /_search
|
||||||
|
|
||||||
### Find documents missing indexed values [find-docs-null-values]
|
### Find documents missing indexed values [find-docs-null-values]
|
||||||
|
|
||||||
To find documents that are missing an indexed value for a field, use the `must_not` [boolean query](/reference/query-languages/query-dsl-bool-query.md) with the `exists` query.
|
To find documents that are missing an indexed value for a field, use the `must_not` [boolean query](/reference/query-languages/query-dsl/query-dsl-bool-query.md) with the `exists` query.
|
||||||
|
|
||||||
The following search returns documents that are missing an indexed value for the `user.id` field.
|
The following search returns documents that are missing an indexed value for the `user.id` field.
|
||||||
|
|
|
@ -360,11 +360,11 @@ The `DECAY_FUNCTION` determines the shape of the decay:
|
||||||
`gauss`
|
`gauss`
|
||||||
: Normal decay, computed as:
|
: Normal decay, computed as:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
where  is computed to assure that the score takes the value `decay` at distance `scale` from `origin`+-`offset`
|
where  is computed to assure that the score takes the value `decay` at distance `scale` from `origin`+-`offset`
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
See [Normal decay, keyword `gauss`](#gauss-decay) for graphs demonstrating the curve generated by the `gauss` function.
|
See [Normal decay, keyword `gauss`](#gauss-decay) for graphs demonstrating the curve generated by the `gauss` function.
|
||||||
|
|
||||||
|
@ -372,11 +372,11 @@ See [Normal decay, keyword `gauss`](#gauss-decay) for graphs demonstrating the c
|
||||||
`exp`
|
`exp`
|
||||||
: Exponential decay, computed as:
|
: Exponential decay, computed as:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
where again the parameter  is computed to assure that the score takes the value `decay` at distance `scale` from `origin`+-`offset`
|
where again the parameter  is computed to assure that the score takes the value `decay` at distance `scale` from `origin`+-`offset`
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
See [Exponential decay, keyword `exp`](#exp-decay) for graphs demonstrating the curve generated by the `exp` function.
|
See [Exponential decay, keyword `exp`](#exp-decay) for graphs demonstrating the curve generated by the `exp` function.
|
||||||
|
|
||||||
|
@ -384,18 +384,18 @@ See [Exponential decay, keyword `exp`](#exp-decay) for graphs demonstrating the
|
||||||
`linear`
|
`linear`
|
||||||
: Linear decay, computed as:
|
: Linear decay, computed as:
|
||||||
|
|
||||||
.
|
.
|
||||||
|
|
||||||
where again the parameter `s` is computed to assure that the score takes the value `decay` at distance `scale` from `origin`+-`offset`
|
where again the parameter `s` is computed to assure that the score takes the value `decay` at distance `scale` from `origin`+-`offset`
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
In contrast to the normal and exponential decay, this function actually sets the score to 0 if the field value exceeds twice the user given scale value.
|
In contrast to the normal and exponential decay, this function actually sets the score to 0 if the field value exceeds twice the user given scale value.
|
||||||
|
|
||||||
|
|
||||||
For single functions the three decay functions together with their parameters can be visualized like this (the field in this example called "age"):
|
For single functions the three decay functions together with their parameters can be visualized like this (the field in this example called "age"):
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
### Multi-values fields [_multi_values_fields]
|
### Multi-values fields [_multi_values_fields]
|
||||||
|
@ -510,10 +510,10 @@ Next, we show how the computed score looks like for each of the three possible d
|
||||||
|
|
||||||
When choosing `gauss` as the decay function in the above example, the contour and surface plot of the multiplier looks like this:
|
When choosing `gauss` as the decay function in the above example, the contour and surface plot of the multiplier looks like this:
|
||||||
|
|
||||||
:::{image} ../../images/normal-decay-keyword-gauss-1.png
|
:::{image} /images/normal-decay-keyword-gauss-1.png
|
||||||
:::
|
:::
|
||||||
|
|
||||||
:::{image} ../../images/normal-decay-keyword-gauss-2.png
|
:::{image} /images/normal-decay-keyword-gauss-2.png
|
||||||
:::
|
:::
|
||||||
|
|
||||||
Suppose your original search results matches three hotels :
|
Suppose your original search results matches three hotels :
|
||||||
|
@ -529,20 +529,20 @@ Suppose your original search results matches three hotels :
|
||||||
|
|
||||||
When choosing `exp` as the decay function in the above example, the contour and surface plot of the multiplier looks like this:
|
When choosing `exp` as the decay function in the above example, the contour and surface plot of the multiplier looks like this:
|
||||||
|
|
||||||
:::{image} ../../images/exponential-decay-keyword-exp-1.png
|
:::{image} /images/exponential-decay-keyword-exp-1.png
|
||||||
:::
|
:::
|
||||||
|
|
||||||
:::{image} ../../images/exponential-decay-keyword-exp-2.png
|
:::{image} /images/exponential-decay-keyword-exp-2.png
|
||||||
:::
|
:::
|
||||||
|
|
||||||
### Linear decay, keyword `linear` [linear-decay]
|
### Linear decay, keyword `linear` [linear-decay]
|
||||||
|
|
||||||
When choosing `linear` as the decay function in the above example, the contour and surface plot of the multiplier looks like this:
|
When choosing `linear` as the decay function in the above example, the contour and surface plot of the multiplier looks like this:
|
||||||
|
|
||||||
:::{image} ../../images/linear-decay-keyword-linear-1.png
|
:::{image} /images/linear-decay-keyword-linear-1.png
|
||||||
:::
|
:::
|
||||||
|
|
||||||
:::{image} ../../images/linear-decay-keyword-linear-2.png
|
:::{image} /images/linear-decay-keyword-linear-2.png
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## Supported fields for decay functions [_supported_fields_for_decay_functions]
|
## Supported fields for decay functions [_supported_fields_for_decay_functions]
|
|
@ -88,7 +88,7 @@ Avoid using a high value in the `max_expansions` parameter, especially if the `p
|
||||||
: (Optional, Boolean) Indicates whether edits include transpositions of two adjacent characters (ab → ba). Defaults to `true`.
|
: (Optional, Boolean) Indicates whether edits include transpositions of two adjacent characters (ab → ba). Defaults to `true`.
|
||||||
|
|
||||||
`rewrite`
|
`rewrite`
|
||||||
: (Optional, string) Method used to rewrite the query. For valid values and more information, see the [`rewrite` parameter](/reference/query-languages/query-dsl-multi-term-rewrite.md).
|
: (Optional, string) Method used to rewrite the query. For valid values and more information, see the [`rewrite` parameter](/reference/query-languages/query-dsl/query-dsl-multi-term-rewrite.md).
|
||||||
|
|
||||||
|
|
||||||
## Notes [fuzzy-query-notes]
|
## Notes [fuzzy-query-notes]
|
|
@ -10,7 +10,7 @@ mapped_pages:
|
||||||
::::{admonition} Deprecated in 7.12.
|
::::{admonition} Deprecated in 7.12.
|
||||||
:class: warning
|
:class: warning
|
||||||
|
|
||||||
Use [Geoshape](/reference/query-languages/query-dsl-geo-shape-query.md) instead where polygons are defined in GeoJSON or [Well-Known Text (WKT)](http://docs.opengeospatial.org/is/18-010r7/18-010r7.html).
|
Use [Geoshape](/reference/query-languages/query-dsl/query-dsl-geo-shape-query.md) instead where polygons are defined in GeoJSON or [Well-Known Text (WKT)](http://docs.opengeospatial.org/is/18-010r7/18-010r7.html).
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ You can use this parameter to query multiple indices that may not contain the `t
|
||||||
: (Optional, integer) Minimum number of child documents that match the `query` required to match the query for a returned parent document. If the parent document does not meet this limit, it is excluded from the search results.
|
: (Optional, integer) Minimum number of child documents that match the `query` required to match the query for a returned parent document. If the parent document does not meet this limit, it is excluded from the search results.
|
||||||
|
|
||||||
`score_mode`
|
`score_mode`
|
||||||
: (Optional, string) Indicates how scores for matching child documents affect the root parent document’s [relevance score](/reference/query-languages/query-filter-context.md#relevance-scores). Valid values are:
|
: (Optional, string) Indicates how scores for matching child documents affect the root parent document’s [relevance score](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores). Valid values are:
|
||||||
|
|
||||||
`none` (Default)
|
`none` (Default)
|
||||||
: Do not use the relevance scores of matching child documents. The query assigns parent documents a score of `0`.
|
: Do not use the relevance scores of matching child documents. The query assigns parent documents a score of `0`.
|
|
@ -72,7 +72,7 @@ GET /my-index-000001/_search
|
||||||
: (Required, query object) Query you wish to run on parent documents of the `parent_type` field. If a parent document matches the search, the query returns its child documents.
|
: (Required, query object) Query you wish to run on parent documents of the `parent_type` field. If a parent document matches the search, the query returns its child documents.
|
||||||
|
|
||||||
`score`
|
`score`
|
||||||
: (Optional, Boolean) Indicates whether the [relevance score](/reference/query-languages/query-filter-context.md) of a matching parent document is aggregated into its child documents. Defaults to `false`.
|
: (Optional, Boolean) Indicates whether the [relevance score](/reference/query-languages/query-dsl/query-filter-context.md) of a matching parent document is aggregated into its child documents. Defaults to `false`.
|
||||||
|
|
||||||
If `false`, {{es}} ignores the relevance score of the parent document. {{es}} also assigns each child document a relevance score equal to the `query`'s `boost`, which defaults to `1`.
|
If `false`, {{es}} ignores the relevance score of the parent document. {{es}} also assigns each child document a relevance score equal to the `query`'s `boost`, which defaults to `1`.
|
||||||
|
|
|
@ -149,7 +149,7 @@ The `pattern` is normalized using the search analyzer from this field, unless `a
|
||||||
The `regexp` rule matches terms using a regular expression pattern. This pattern can expand to match at most `indices.query.bool.max_clause_count` [search setting](/reference/elasticsearch/configuration-reference/search-settings.md) terms. If the pattern matches more terms,{{es}} returns an error.
|
The `regexp` rule matches terms using a regular expression pattern. This pattern can expand to match at most `indices.query.bool.max_clause_count` [search setting](/reference/elasticsearch/configuration-reference/search-settings.md) terms. If the pattern matches more terms,{{es}} returns an error.
|
||||||
|
|
||||||
`pattern`
|
`pattern`
|
||||||
: (Required, string) Regexp pattern used to find matching terms. For a list of operators supported by the `regexp` pattern, see [Regular expression syntax](/reference/query-languages/regexp-syntax.md).
|
: (Required, string) Regexp pattern used to find matching terms. For a list of operators supported by the `regexp` pattern, see [Regular expression syntax](/reference/query-languages/query-dsl/regexp-syntax.md).
|
||||||
|
|
||||||
::::{warning}
|
::::{warning}
|
||||||
Avoid using wildcard patterns, such as `.*` or `.*?+``. This can increase the iterations needed to find matching terms and slow search performance.
|
Avoid using wildcard patterns, such as `.*` or `.*?+``. This can increase the iterations needed to find matching terms and slow search performance.
|
|
@ -0,0 +1,64 @@
|
||||||
|
---
|
||||||
|
navigation_title: "Match boolean prefix"
|
||||||
|
mapped_pages:
|
||||||
|
- https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-bool-prefix-query.html
|
||||||
|
---
|
||||||
|
|
||||||
|
# Match boolean prefix query [query-dsl-match-bool-prefix-query]
|
||||||
|
|
||||||
|
|
||||||
|
A `match_bool_prefix` query analyzes its input and constructs a [`bool` query](/reference/query-languages/query-dsl/query-dsl-bool-query.md) from the terms. Each term except the last is used in a `term` query. The last term is used in a `prefix` query. A `match_bool_prefix` query such as
|
||||||
|
|
||||||
|
```console
|
||||||
|
GET /_search
|
||||||
|
{
|
||||||
|
"query": {
|
||||||
|
"match_bool_prefix" : {
|
||||||
|
"message" : "quick brown f"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
where analysis produces the terms `quick`, `brown`, and `f` is similar to the following `bool` query
|
||||||
|
|
||||||
|
```console
|
||||||
|
GET /_search
|
||||||
|
{
|
||||||
|
"query": {
|
||||||
|
"bool" : {
|
||||||
|
"should": [
|
||||||
|
{ "term": { "message": "quick" }},
|
||||||
|
{ "term": { "message": "brown" }},
|
||||||
|
{ "prefix": { "message": "f"}}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
An important difference between the `match_bool_prefix` query and [`match_phrase_prefix`](/reference/query-languages/query-dsl/query-dsl-match-query-phrase-prefix.md) is that the `match_phrase_prefix` query matches its terms as a phrase, but the `match_bool_prefix` query can match its terms in any position. The example `match_bool_prefix` query above could match a field containing `quick brown fox`, but it could also match `brown fox quick`. It could also match a field containing the term `quick`, the term `brown` and a term starting with `f`, appearing in any position.
|
||||||
|
|
||||||
|
## Parameters [_parameters]
|
||||||
|
|
||||||
|
By default, `match_bool_prefix` queries' input text will be analyzed using the analyzer from the queried field’s mapping. A different search analyzer can be configured with the `analyzer` parameter
|
||||||
|
|
||||||
|
```console
|
||||||
|
GET /_search
|
||||||
|
{
|
||||||
|
"query": {
|
||||||
|
"match_bool_prefix": {
|
||||||
|
"message": {
|
||||||
|
"query": "quick brown f",
|
||||||
|
"analyzer": "keyword"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`match_bool_prefix` queries support the [`minimum_should_match`](/reference/query-languages/query-dsl/query-dsl-minimum-should-match.md) and `operator` parameters as described for the [`match` query](/reference/query-languages/query-dsl/query-dsl-match-query.md#query-dsl-match-query-boolean), applying the setting to the constructed `bool` query. The number of clauses in the constructed `bool` query will in most cases be the number of terms produced by analysis of the query text.
|
||||||
|
|
||||||
|
The [`fuzziness`](/reference/query-languages/query-dsl/query-dsl-match-query.md#query-dsl-match-query-fuzziness), `prefix_length`, `max_expansions`, `fuzzy_transpositions`, and `fuzzy_rewrite` parameters can be applied to the `term` subqueries constructed for all terms but the final term. They do not have any effect on the prefix query constructed for the final term.
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ mapped_pages:
|
||||||
# Match phrase prefix query [query-dsl-match-query-phrase-prefix]
|
# Match phrase prefix query [query-dsl-match-query-phrase-prefix]
|
||||||
|
|
||||||
|
|
||||||
Returns documents that contain the words of a provided text, in the **same order** as provided. The last term of the provided text is treated as a [prefix](/reference/query-languages/query-dsl-prefix-query.md), matching any words that begin with that term.
|
Returns documents that contain the words of a provided text, in the **same order** as provided. The last term of the provided text is treated as a [prefix](/reference/query-languages/query-dsl/query-dsl-prefix-query.md), matching any words that begin with that term.
|
||||||
|
|
||||||
## Example request [match-phrase-prefix-query-ex-request]
|
## Example request [match-phrase-prefix-query-ex-request]
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ GET /_search
|
||||||
`query`
|
`query`
|
||||||
: (Required, string) Text you wish to find in the provided `<field>`.
|
: (Required, string) Text you wish to find in the provided `<field>`.
|
||||||
|
|
||||||
The `match_phrase_prefix` query [analyzes](docs-content://manage-data/data-store/text-analysis.md) any provided text into tokens before performing a search. The last term of this text is treated as a [prefix](/reference/query-languages/query-dsl-prefix-query.md), matching any words that begin with that term.
|
The `match_phrase_prefix` query [analyzes](docs-content://manage-data/data-store/text-analysis.md) any provided text into tokens before performing a search. The last term of this text is treated as a [prefix](/reference/query-languages/query-dsl/query-dsl-prefix-query.md), matching any words that begin with that term.
|
||||||
|
|
||||||
|
|
||||||
`analyzer`
|
`analyzer`
|
||||||
|
@ -59,7 +59,7 @@ The `match_phrase_prefix` query [analyzes](docs-content://manage-data/data-store
|
||||||
: No documents are returned if the `analyzer` removes all tokens.
|
: No documents are returned if the `analyzer` removes all tokens.
|
||||||
|
|
||||||
`all`
|
`all`
|
||||||
: Returns all documents, similar to a [`match_all`](/reference/query-languages/query-dsl-match-all-query.md) query.
|
: Returns all documents, similar to a [`match_all`](/reference/query-languages/query-dsl/query-dsl-match-all-query.md) query.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ GET /_search
|
||||||
: No documents are returned if the `analyzer` removes all tokens.
|
: No documents are returned if the `analyzer` removes all tokens.
|
||||||
|
|
||||||
`all`
|
`all`
|
||||||
: Returns all documents, similar to a [`match_all`](/reference/query-languages/query-dsl-match-all-query.md) query.
|
: Returns all documents, similar to a [`match_all`](/reference/query-languages/query-dsl/query-dsl-match-all-query.md) query.
|
||||||
|
|
||||||
|
|
||||||
A phrase query matches terms up to a configurable `slop` (which defaults to 0) in any order. Transposed terms have a slop of 2.
|
A phrase query matches terms up to a configurable `slop` (which defaults to 0) in any order. Transposed terms have a slop of 2.
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue