Skip to content

Commit

Permalink
[Docs] Add term query with normalizer example
Browse files Browse the repository at this point in the history
  • Loading branch information
wmellouli authored and Christoph Büscher committed May 3, 2018
1 parent 3ab60ae commit ea1b330
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
14 changes: 12 additions & 2 deletions docs/reference/mapping/params/normalizer.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
--------------------------------
Expand Down Expand Up @@ -53,6 +54,15 @@ PUT index/type/3
POST index/_refresh
GET index/_search
{
"query": {
"term": {
"foo": "BAR"
}
}
}
GET index/_search
{
"query": {
Expand All @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion docs/reference/query-dsl/term-level-queries.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ea1b330

Please sign in to comment.