analyzer
edit
Only text
fields support the analyzer
mapping parameter.
The analyzer
parameter specifies the analyzer used for
text analysis when indexing or searching a text
field.
Unless overridden with the search_analyzer
mapping
parameter, this analyzer is used for both index and
search analysis. See Specify an analyzer.
We recommend testing analyzers before using them in production. See Test an analyzer.
The analyzer
setting can not be updated on existing fields
using the update mapping API.
search_quote_analyzer
edit
The search_quote_analyzer
setting allows you to specify an analyzer for phrases, this is particularly useful when dealing with disabling
stop words for phrase queries.
To disable stop words for phrases a field utilising three analyzer settings will be required:
-
An
analyzer
setting for indexing all terms including stop words -
A
search_analyzer
setting for non-phrase queries that will remove stop words -
A
search_quote_analyzer
setting for phrase queries that will not remove stop words
PUT my-index-000001 { "settings":{ "analysis":{ "analyzer":{ "my_analyzer":{ "type":"custom", "tokenizer":"standard", "filter":[ "lowercase" ] }, "my_stop_analyzer":{ "type":"custom", "tokenizer":"standard", "filter":[ "lowercase", "english_stop" ] } }, "filter":{ "english_stop":{ "type":"stop", "stopwords":"_english_" } } } }, "mappings":{ "properties":{ "title": { "type":"text", "analyzer":"my_analyzer", "search_analyzer":"my_stop_analyzer", "search_quote_analyzer":"my_analyzer" } } } } PUT my-index-000001/_doc/1 { "title":"The Quick Brown Fox" } PUT my-index-000001/_doc/2 { "title":"A Quick Brown Fox" } GET my-index-000001/_search { "query":{ "query_string":{ "query":"\"the quick brown fox\"" } } }
The search_quote_analyzer
setting can be updated on existing fields
using the update mapping API.
|
|
|
|
|
|
|
|
|
|
Since the query is wrapped in quotes it is detected as a phrase query therefore the |