Query works in elastic search but does not work in Kibana discover


(Malay M) #1

I've an index of dummy logs having a field called "sequence" I want to sort on basis of this field, so while getting the data in ElasticSearch I use the following query

{
  "query": {
    "match": {
      "trace_id": "5f6e223c-b5ac-11e8-96f8-529269fb1459"
    }
  },
  "sort": [
    {
      "sequence": {
        "order": "asc"
      }
    }
  ]
}

This works perfectly fine and gives me docs in ascending order. But when I put same query in Kibana's discover tab's filter using edit query DSL it only searches for docs with trace_id = 5f6e223c-b5ac-11e8-96f8-529269fb1459 and does not sort these docs.

Can anyone explain what I am doing wrong here?

Thanks,
Malay M


(Matt Bargar) #2

The "edit query DSL" section of the filter editor only accepts the query portion of the search request body, you can't specify a sort in there.

To sort, you need to add sequence as a column in the doc table and click on the arrow in its column header.


(Malay M) #3

I see, I did the way you suggested and it works , but when I initially tried it I thought it was a hack and not the right way to do it. :sweat_smile: Thanks for the help.


(system) #4

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