首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >_source.includes在弹性搜索_search api中支持的字段的最大数量?

_source.includes在弹性搜索_search api中支持的字段的最大数量?
EN

Stack Overflow用户
提问于 2021-11-25 16:04:20
回答 1查看 357关注 0票数 0

在查询_source.includes中包含超过1500个字段的索引时,我从ES中得到以下错误。

错误日志:

代码语言:javascript
运行
复制
{
  "took": 154,
  "timed_out": false,
  "_shards": {
    "total": 28,
    "successful": 15,
    "skipped": 0,
    "failed": 13,
    "failures": [
      {
        "shard": 0,
        "index": "index123",
        "node": "...",
        "reason": {
          "type": "too_complex_to_determinize_exception",
          "reason": "too_complex_to_determinize_exception: Determinizing automaton with 52903 states and 54499 transitions would result in more than 10000 states."
        }
      }
    ]
  },....

下面是我要执行的示例查询。

查询示例:

代码语言:javascript
运行
复制
{
    "explain": false,
    "size": 20,
    "query": {
        "bool": {
            "filter": [
                {
                    "bool": {
                        "adjust_pure_negative": true,
                        "must": [
                            {
                                "terms": {
                                    "boost": 1,
                                    "type": [
                                        "University"
                                    ]
                                }
                            }
                        ],
                        "boost": 1
                    }
                }
            ],
            "adjust_pure_negative": true,
            "boost": 1
        }
    },
    "from": 0,
    "_source": {
        "excludes": [
            
        ],
        "includes": [
            --1579 fields included --
        ]
    }
    
}

Note:当尝试将字段数量降低到_source.includes中的1440个左右时,ES能够在没有错误的情况下给出响应。

我想知道在_source中添加的数字字段是否有任何硬限制,或者是否有任何配置设置来增加这个限制。

如果有其他方法可以让这么多的字段被包含并从ES中返回的话,这也是有帮助的。

提前感谢!

EN

回答 1

Stack Overflow用户

发布于 2021-11-26 06:55:58

对于这么多字段,您应该排除(使用_source.excludes)不需要的字段,而不是包含所需的字段,查询中的字段将更少。

另一种解决方案,因为_source has limitations with a high number of fields,您还可以利用通常比_source性能更好的fields option

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70114146

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档