[Docs] Add term query with normalizer example

This commit is contained in:
wmellouli 2018-05-03 10:23:14 +02:00 committed by Christoph Büscher
parent 09b918545d
commit c8d8407012
2 changed files with 14 additions and 3 deletions

View File

@ -7,7 +7,8 @@ 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 <<query-dsl-match-query,`match`>> query.
the <<query-dsl-match-query,`match`>> query or via a term level query
such as the <<query-dsl-term-query,`term`>> query.
[source,js]
--------------------------------
@ -53,6 +54,15 @@ PUT index/_doc/3
POST index/_refresh
GET index/_search
{
"query": {
"term": {
"foo": "BAR"
}
}
}
GET index/_search
{
"query": {
@ -64,7 +74,7 @@ GET index/_search
--------------------------------
// CONSOLE
The above query matches documents 1 and 2 since `BÀR` is converted to `bar` at
The above queries match documents 1 and 2 since `BÀR` is converted to `bar` at
both index and query time.
[source,js]

View File

@ -3,7 +3,8 @@
While the <<full-text-queries,full text queries>> will analyze the query
string before executing, the _term-level queries_ operate on the exact terms
that are stored in the inverted index.
that are stored in the inverted index, and will normalize terms before executing
only for <<keyword,`keyword`>> fields with <<normalizer,`normalizer`>> property.
These queries are usually used for structured data like numbers, dates, and
enums, rather than full text fields. Alternatively, they allow you to craft