简体   繁体   中英

What is the side effect of disabling analyzer in elasticsearch?

To make aggregation work, I had the analyzer disabled as well ( as described here in this link )

Now I'm wondering if there's a side effect? eg does it impact the search performance?

There isn't much in the official document, and I'm only talking about the default analyzer

Of course there is a side-effect. Now a field whose value was say "foo bar" will not be searchable if the user searches only "foo".

To make aggregations work on a non-analyzed field, you can try converting that field into a multi-fields .

"not_analyzed" fields do only make exact matches of the full query.

They are especially useful for tags that shouldn't be split into multiple tokens: ids, tags, mails addresses, name of cities, etc

The performance and side effects with aggregations will depends on what you are trying to achieve.

If you make aggregations on string fields containing tags; cities names for example, you would want to not analyze or "New York" will be split as "New" and "York" for example. Statistics made on "York" will refer both for New York and York, the english city! This is not wanted.

If you are making aggregation on texts, to find the more frequent words for example, you could want to have an analyzed field because you would want to count "new" and "york" separately.

See the documentation for more information on how the analysis affects the aggregations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM