Usually, the same analyzer should be applied at index time and at search time, to ensure that the terms in the query are in the same format as the terms in the inverted index.
Sometimes, though, it can make sense to use a different analyzer at search time, such as when using theedge_ngram
tokenizer for autocomplete.
By default, queries will use theanalyzer
defined in the field mapping, but this can be overridden with thesearch_analyzer
setting:
参考
【1】Elasticsearch中analyzer和search_analyzer的区别
【2】elasticsearch reference: search-analyzer
网友评论