多级嵌套和反向嵌套聚合的Elasticsearch index_out_of_bounds异常

时间:2019-06-12 19:55:29

标签: elasticsearch indexoutofboundsexception elasticsearch-5 elasticsearch-aggregation elasticsearch-query

我有一个带有多个深层嵌套的elasticsearch索引。我正在一个深层字段上执行术语汇总,并希望获取另一个关联的深层字段的所有记录。为此,我正在使用top_hits聚合。但是我的查询返回了“ index_out_of_bounds”异常。

以下是索引映射:

{
  "mappings": {
  "type": {
    "properties": {
      "campaigns": {
        "type": "nested",
        "properties": {
          "campaign_id": {
            "type": "integer"
          },
          "campaign_name": {
            "type": "text"
          },
          "contents": {
            "type": "nested",
            "properties": {
              "content_id": {
                "type": "integer"
              },
              "content_name": {
                "type": "text",
                "fielddata": true
              }
            }
          }
        }
      },
      "forms": {
        "type": "nested",
        "properties": {
          "form_id": {
            "type": "integer"
          },
          "form_issubmitted": {
            "type": "integer"
          },
          "form_name": {
            "type": "text"
          },
          "form_tabs": {
            "type": "nested",
            "properties": {
              "tab_id": {
                "type": "integer"
              },
              "tab_name": {
                "type": "text"
              },
              "tab_section": {
                "properties": {
                  "section_id": {
                    "type": "long"
                  },
                  "section_name": {
                    "type": "text",
                    "fields": {
                      "keyword": {
                        "type": "keyword",
                        "ignore_above": 256
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
}

我的查询看起来像这样:

{
  "size": 0,
  "aggs": {
    "sectionAgg": {
      "nested": {
        "path": "forms.form_tabs.tab_sections"
      },
      "aggs": {
        "termsField": {
          "filter": {
            "bool": {}
          },
          "aggs": {
            "sectionFields": {
              "terms": {
                "field": "forms.form_tabs.tab_sections.section_id",
                "size": 10000
              },
              "aggs": {
                "sectionFieldDocs": {
                  "top_hits": {
                    "size": 1,
                    "_source": [
                      "forms.form_tabs.tab_sections.*"
                    ]
                  }
                },
                "completioncampaigns.contentsFields": {
                  "reverse_nested": {
                    "path": "campaigns.contents"
                  },
                  "aggs": {
                    "completionFieldFilter": {
                      "filter": {
                        "bool": {}
                      },
                      "aggs": {
                        "campaignContents": {
                          "top_hits": {
                            "size": 100,
                            "_source": [
                              "campaigns.contents.*"
                            ]
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

否则将不会粘贴整个结果,这将非常漫长。但是它也确实有聚合数据。

这让我犯了这样的错误

{
  "took": 178,
  "timed_out": false,
  "_shards": {
      "total": 5,
      "successful": 2,
      "skipped": 0,
      "failed": 3,
      "failures": [
          {
              "shard": 1,
              "index": "userlocal",
              "node": "KmxVF34iTXWeLFLmtCy7WQ",
              "reason": {
                  "type": "index_out_of_bounds_exception",
                  "reason": "2147483647 is out of bounds: [0-803["
              }
          },
          {
              "shard": 2,
              "index": "userlocal",
              "node": "KmxVF34iTXWeLFLmtCy7WQ",
              "reason": {
                  "type": "index_out_of_bounds_exception",
                  "reason": "2147483647 is out of bounds: [0-1278["
              }
          },
          {
              "shard": 4,
              "index": "userlocal",
              "node": "KmxVF34iTXWeLFLmtCy7WQ",
              "reason": {
                  "type": "index_out_of_bounds_exception",
                  "reason": "2147483647 is out of bounds: [0-2659["
              }
          }
      ]
  }
}

我想知道为什么会发生此错误以及如何解决此问题。

0 个答案:

没有答案