禁用Elasticsearch搜索分析器 [英] Disabling Elasticsearch search analyzer

查看:161
本文介绍了禁用Elasticsearch搜索分析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • 我正在研究Elasticsearch 7.2版,我正在使用

    改善ES通话性能的过程 应用程序.
  • 根据我的阅读,如果我们尚未设置搜索分析器",则 默认的标准分析仪将被设置.
  • 但是在不需要分析仪的情况下,请使用分析仪 可能会影响性能.将所有字段都设为关键字" 防止这种情况?
  • 或者还有其他方法可以禁用此搜索分析器"
  • 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: 对于任何答案,如果您可以指出答案所基于的ES官方文档,我将不胜感激.

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.

查询类型:-分析了一些查询,但没有分析.分析过的查询,例如匹配查询在索引映射中定义的字段上使用相同的分析器,而诸如 elasticsearch匹配与词条查询

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

ES官方文档的摘录

匹配查询的类型为boolean.这意味着提供的文本是 分析,分析过程从 提供的文字.

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.

字段类型:默认情况下会分析文本字段,而标准分析器是默认的分析器,因此,如果您没有在索引映射中为文本字段定义分析器,然后进行匹配查询,它将使用standard分析器,但如果使用term查询,则将不使用搜索时间分析器.
而如果您使用keyword字段,则将使用关键字分析器,它是无操作分析器,因此,对于关键字字段的匹配查询,它将使用关键字分析器,但是本质上就像不应用搜索时间分析器一样.

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.
While if you use 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.

同时,我还将研究是否可以显式禁用搜索时间分析器.

Meanwhile, I'll also look if we can explicitly disable the search time analyzers.

这篇关于禁用Elasticsearch搜索分析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆