简体   繁体   中英

Disabling Elasticsearch search analyzer

  • I'm working on the elasticsearch version 7.2 and i'm in the
    process of improving the performance of ES calls made by the
    application.
  • From what I read, if we haven't set a "search analyzer" , by default standard analyzer will be set.
  • But in a case where a analyzer is not needed ,having an analyzer may affect performance. Do having all fields as "keywords" prevents this?
  • Or is there any other way to disable this "search analyzer"

Ps: For any answer if you could point me to the ES official documentation of which the answer is based on , I"ll really appreciate.

There are various scenarios where search analyzers come into the picture.

Type of query :- Some queries are analyzed and some are not. queries which are analyzed like match query uses the same analyzer on the fields which were defined in the index mapping, while queries like term query don't use any search time analyzer. Read elasticsearch match vs term query

Also snippet from official ES doc

The match query is of type boolean. It means that the text provided is analyzed and the analysis process constructs a boolean query from the provided text.

Type of fields :

Text fields are analyzed by default and standard analyzer is the default analyzer for them, hence if you don't define an analyzer for text fields in index mapping and then make a match query, it would use the standard analyzer but if you use the term query then it would not use the search time analyzer.

keyword fields then it would use the keyword analyzer, which is no-op analyzer, hence for match query on keyword fields it would use the keyword analyzer but is essentially like applying no search time analyzer.

If you are using the match query or any other analyzed query, which uses the search time analyzers, then you can explicitly mention the search time analyzer as a keyword analyzer , which as I explained is a no-op analyzer, hence process of generating the tokens would be very efficient.

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