|
1 | 1 | [[term-level-queries]]
|
2 |
| -== Term level queries |
| 2 | +== Term-level queries |
3 | 3 |
|
4 |
| -While the <<full-text-queries,full text queries>> will analyze the query |
5 |
| -string before executing, the _term-level queries_ operate on the exact terms |
6 |
| -that are stored in the inverted index, and will normalize terms before executing |
7 |
| -only for <<keyword,`keyword`>> fields with <<normalizer,`normalizer`>> property. |
| 4 | +You can use **term-level queries** to find documents based on precise values in |
| 5 | +structured data. Examples of structured data include date ranges, IP addresses, |
| 6 | +prices, or product IDs. |
8 | 7 |
|
9 |
| -These queries are usually used for structured data like numbers, dates, and |
10 |
| -enums, rather than full text fields. Alternatively, they allow you to craft |
11 |
| -low-level queries, foregoing the analysis process. |
| 8 | +Unlike <<full-text-queries, full-text queries>>, term-level queries do not |
| 9 | +analyze search terms. Instead, term-level queries match the exact terms stored |
| 10 | +in a field. |
12 | 11 |
|
13 |
| -The queries in this group are: |
14 | 12 |
|
15 |
| -<<query-dsl-term-query,`term` query>>:: |
| 13 | +[NOTE] |
| 14 | +==== |
| 15 | +Term-level queries still normalize search terms for `keyword` fields with the |
| 16 | +`normalizer` property. For more details, see <<normalizer, `normalizer`>>. |
| 17 | +==== |
16 | 18 |
|
17 |
| - Find documents which contain the exact term specified in the field |
18 |
| - specified. |
| 19 | +[float] |
| 20 | +[[term-level-query-types]] |
| 21 | +=== Types of term-level queries |
19 | 22 |
|
20 |
| -<<query-dsl-terms-query,`terms` query>>:: |
| 23 | +<<query-dsl-term-query,`term` query>>:: |
| 24 | +Returns documents that contain an exact term in a provided field. |
21 | 25 |
|
22 |
| - Find documents which contain any of the exact terms specified in the field |
23 |
| - specified. |
| 26 | +<<query-dsl-terms-query,`terms` query>>:: |
| 27 | +Returns documents that contain one or more exact terms in a provided field. |
24 | 28 |
|
25 | 29 | <<query-dsl-terms-set-query,`terms_set` query>>::
|
26 |
| - |
27 |
| - Find documents which match with one or more of the specified terms. The |
28 |
| - number of terms that must match depend on the specified minimum should |
29 |
| - match field or script. |
| 30 | +Returns documents that contain a minimum number of exact terms in a provided |
| 31 | +field. You can define the minimum number of matching terms using a field or |
| 32 | +script. |
30 | 33 |
|
31 | 34 | <<query-dsl-range-query,`range` query>>::
|
32 |
| - |
33 |
| - Find documents where the field specified contains values (dates, numbers, |
34 |
| - or strings) in the range specified. |
| 35 | +Returns documents that contain terms within a provided range. |
35 | 36 |
|
36 | 37 | <<query-dsl-exists-query,`exists` query>>::
|
37 |
| - |
38 |
| - Find documents where the field specified contains any non-null value. |
| 38 | +Returns documents that contain any indexed value for a field. |
39 | 39 |
|
40 | 40 | <<query-dsl-prefix-query,`prefix` query>>::
|
41 |
| - |
42 |
| - Find documents where the field specified contains terms which begin with |
43 |
| - the exact prefix specified. |
| 41 | +Returns documents that contain a specific prefix in a provided field. |
44 | 42 |
|
45 | 43 | <<query-dsl-wildcard-query,`wildcard` query>>::
|
46 |
| - |
47 |
| - Find documents where the field specified contains terms which match the |
48 |
| - pattern specified, where the pattern supports single character wildcards |
49 |
| - (`?`) and multi-character wildcards (`*`) |
| 44 | +Returns documents that contain terms matching a wildcard pattern. |
50 | 45 |
|
51 | 46 | <<query-dsl-regexp-query,`regexp` query>>::
|
52 |
| - |
53 |
| - Find documents where the field specified contains terms which match the |
54 |
| - <<regexp-syntax,regular expression>> specified. |
| 47 | +Returns documents that contain terms matching a |
| 48 | +https://en.wikipedia.org/wiki/Regular_expression[regular expression]. |
55 | 49 |
|
56 | 50 | <<query-dsl-fuzzy-query,`fuzzy` query>>::
|
57 |
| - |
58 |
| - Find documents where the field specified contains terms which are fuzzily |
59 |
| - similar to the specified term. Fuzziness is measured as a |
60 |
| - http://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance[Levenshtein edit distance] |
61 |
| - of 1 or 2. |
| 51 | +Returns documents that contain terms similar to the search term. {es} measures |
| 52 | +similarity, or fuzziness, using a |
| 53 | +http://en.wikipedia.org/wiki/Levenshtein_distance[Levenshtein edit distance]. |
62 | 54 |
|
63 | 55 | <<query-dsl-ids-query,`ids` query>>::
|
64 |
| - |
65 |
| - Find documents with the specified IDs. |
| 56 | +Returns documents based on their <<mapping-id-field, document IDs>>. |
66 | 57 |
|
67 | 58 |
|
68 | 59 | include::term-query.asciidoc[]
|
|
0 commit comments