"illegal_state_exception" occurs top_hits aggregator is used


(Emrah) #1

Hi, I am having a trouble to find out the actual problem why "illegal_state_exception" occurs when top_hits is used in Elasticsearch 6.4.2 even though same query and aggregations work in the same version but on another machine, which is the local environment.

Any opinions?

BTW, my goal is to sort by text on buckets.

Below you may find partial settings with mapping also the aggregation.

"settings": {
  "analysis": {
    "normalizer": {
      "custom_normalizer": {
        "filter": [
          "lowercase",
          "asciifolding"
        ],
        "type": "custom",
        "char_filter": []
      }
    }
  }
}

"mapping": {
  "my_type": {
    "dynamic": "false",
    "properties": {
      "name": {
        "type": "text",
        "fields": {
          "raw": {
            "type": "keyword",
            "normalizer": "custom_normalizer"
          }
        },
        "analyzer": "english"
      },
    }
  }
}

"aggs": {
  "tags": {
    "children": {
      "type": "tags"
    },
    "aggs": {
      "platforms": {
        "terms": {
          "field": "name.raw",
          "size": 100,
          "order": {
            "_key": "asc"
          }
        },
        "aggs": {
          "platform": {
            "top_hits": {
              "size": 1,
              "_source": true
            }
          },
          "bucket_truncate": {
            "bucket_sort": {
              "from": 0,
              "size": 250
            }
          }
        }
      }
    }
  }
}

(Alexander Reelsen) #2

please use markdown to properly format the JSON snippet and also share the full stack trace. thanks!


(Emrah) #3

I found out that the issue was related to nested queries. Thanks!


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.