Skip to content

Commit c8d8407

Browse files
wmellouliChristoph Büscher
authored and
Christoph Büscher
committed
[Docs] Add term query with normalizer example
1 parent 09b9185 commit c8d8407

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

docs/reference/mapping/params/normalizer.asciidoc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ 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.
10+
the <<query-dsl-match-query,`match`>> query or via a term level query
11+
such as the <<query-dsl-term-query,`term`>> query.
1112

1213
[source,js]
1314
--------------------------------
@@ -53,6 +54,15 @@ PUT index/_doc/3
5354
5455
POST index/_refresh
5556
57+
GET index/_search
58+
{
59+
"query": {
60+
"term": {
61+
"foo": "BAR"
62+
}
63+
}
64+
}
65+
5666
GET index/_search
5767
{
5868
"query": {
@@ -64,7 +74,7 @@ GET index/_search
6474
--------------------------------
6575
// CONSOLE
6676

67-
The above query matches documents 1 and 2 since `BÀR` is converted to `bar` at
77+
The above queries match documents 1 and 2 since `BÀR` is converted to `bar` at
6878
both index and query time.
6979

7080
[source,js]

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
While the <<full-text-queries,full text queries>> will analyze the query
55
string before executing, the _term-level queries_ operate on the exact terms
6-
that are stored in the inverted index.
6+
that are stored in the inverted index, and will normalize terms before executing
7+
only for <<keyword,`keyword`>> fields with <<normalizer,`normalizer`>> property.
78

89
These queries are usually used for structured data like numbers, dates, and
910
enums, rather than full text fields. Alternatively, they allow you to craft

0 commit comments

Comments
 (0)