Elasticsearch Java API client 8.5, does generate the correct format for source ordering for composition aggregation

Hi,
I am using Elasticsearch Java API client 8.5. I need to be able to specified the order for the sources such as for date histogram aggregation as the source. However the issue is that it generates array as the value for "order" instead of just string value. I believe this format works for regular aggregations but when the aggregation is a composite source. I am basically calling this method to set the order https://github.com/elastic/elasticsearch-java/blob/49bdd62281915d2c74d671988be35b26fc56ab78/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateHistogramAggregation.java#L557. I am looking for a method or a way to say this aggregation is a composite source so deserialize the order differently instead of making it a list, just make the value for order as a string.

Example:

{
  "aggs": {
    "my_buckets": {
      "composite": {
        "sources": [
          { "date": { "date_histogram": { "field": "e", "calendar_interval": "1d",
          "order": [{"_key":"asc"}]
          } } } 
        ]
      }
    }
  }
}

Error(s):

{
  "error": {
    "root_cause": [
      {
        "type": "x_content_parse_exception",
        "reason": "[8:20] [date_histogram] order doesn't support values of type: START_ARRAY"
      }
    ],
    "type": "x_content_parse_exception",
    "reason": "[8:20] [composite] failed to parse field [sources]",
    "caused_by": {
      "type": "x_content_parse_exception",
      "reason": "[8:20] [date_histogram] order doesn't support values of type: START_ARRAY"
    }
  },
  "status": 400
}

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