Disabling Elasticsearch search analyzer

前端 未结 1 1331
悲哀的现实
悲哀的现实 2021-01-15 16:17
  • 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
1条回答
  •  说谎
    说谎 (楼主)
    2021-01-15 16:58

    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.

    0 讨论(0)
提交回复
热议问题