Skip to content

Commit 97f70c5

Browse files
authored
[DOCS] Rewrite term-level queries overview (#43337)
1 parent 48aa716 commit 97f70c5

File tree

3 files changed

+34
-43
lines changed

3 files changed

+34
-43
lines changed

docs/java-rest/high-level/query-builders.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This page lists all the available search queries with their corresponding `Query
2727
| {ref}/query-dsl-simple-query-string-query.html[Simple Query String] | {query-ref}/SimpleQueryStringBuilder.html[SimpleQueryStringBuilder] | {query-ref}/QueryBuilders.html#simpleQueryStringQuery-java.lang.String-[QueryBuilders.simpleQueryStringQuery()]
2828
|======
2929

30-
==== Term level queries
30+
==== Term-level queries
3131
[options="header"]
3232
|======
3333
| Search Query | QueryBuilder Class | Method in QueryBuilders

docs/reference/mapping/params/normalizer.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ produces a single token.
77

88
The `normalizer` is applied prior to indexing the keyword, as well as at
99
search-time when the `keyword` field is searched via a query parser such as
10-
the <<query-dsl-match-query,`match`>> query or via a term level query
10+
the <<query-dsl-match-query,`match`>> query or via a term-level query
1111
such as the <<query-dsl-term-query,`term`>> query.
1212

1313
[source,js]

docs/reference/query-dsl/term-level-queries.asciidoc

Lines changed: 32 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,59 @@
11
[[term-level-queries]]
2-
== Term level queries
2+
== Term-level queries
33

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.
87

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.
1211

13-
The queries in this group are:
1412

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+
====
1618

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
1922

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.
2125

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.
2428

2529
<<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.
3033

3134
<<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.
3536

3637
<<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.
3939

4040
<<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.
4442

4543
<<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.
5045

5146
<<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].
5549

5650
<<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].
6254

6355
<<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>>.
6657

6758

6859
include::term-query.asciidoc[]

0 commit comments

Comments
 (0)