Aggregation is not working occasionally

Hi,

I'm using Elasticsearch 7.16.2 and posting query by Dev Tools of Kibana 7.16.2.

I got strange results from an aggregation query.

When I repeat completely the same query:

GET ss-mix2_omp-01_active/_search
{
  "size":0,
  "_source": false, 
  "aggs": {
    "order": {
      "nested": {
        "path": "MESSAGE.ORDER_N"
      },
      "aggs": {
        "givecode": {
          "multi_terms": {
            "terms": [{
              "field": "MESSAGE.ORDER_N.RXE.02_GiveCode.01_Identifier",
              "missing": ""
            },{
              "field": "MESSAGE.ORDER_N.RXE.02_GiveCode.02_Text",
              "missing": ""
            }],
            "size":1
          }
        }
      }
    }
  }
}

Sometimes I got results ignoring aggregation query:

{
  "took" : 422,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : 1.0,
    "hits" : [{"..."}]
  }
}

containing 1 hit with overall _source field. Root size and _source parameter also looks not working. The size for aggregation looks to be used for global siez parameter.

Sometimes I got correct results:

{
  "took" : 28275,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "aggregations" : {
    "order" : {
      "doc_count" : 27801024,
      "givecode" : {
        "doc_count_error_upper_bound" : 0,
        "sum_other_doc_count" : 27357513,
        "buckets" : [
          {
            "key" : [
              "114191701",
              "バイアスピリン錠100mg"
            ],
            "key_as_string" : "114191701|バイアスピリン錠100mg",
            "doc_count" : 443511
          }
        ]
      }
    }
  }
}

It's really strange that the results are inconsistent. Is this expected behavior or a known bug? Is there anything I should check?

I couldn't reproduce the results with a small test index.

Thanks.

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