Convert a search JSON into a DSL query

I have created the following search query in Elastic. I am wanting to using it in a Discover query using the Elasticsearch Query DSL. However, I cannot seem to convert it. This is the query that I have using Kibana Dev console:

GET testssl*/_search
{
  "aggs": {
    "2": {
      "terms": {
        "field": "identifierTupple",
        "order": {
          "_key": "desc"
        },
        "size": 120
      },
      "aggs": {
        "1": {
          "top_hits": {
            "size": 1,
            "sort": [
              {
                "timestamp": {
                  "order": "desc"
                }
              }
            ]
          }
        }
      }
    }
  },
  "size": 0
}

I cannot seem to convert the above to elastic DSL to use. Is this possible?

My outcome is to create a discover view showing the top hits of identifierTupple.

Hi

We are currently not supporting aggregation in Discover, but we are working on making this possible in the future. Here is an older issue for that:

Best,
Matthias

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