Sort field Using Kibana

Hi

I was wondering how to go about sorting one field wrt another field. Suppose we have two fields in our object.
eg.
1 {
id: x1
val : 3 }
2{
id: x2
val : 4 }
Can we sort id's as x2,x1 (wrt val in this scenario) in kibana?

Thanks.

Sure, just add both to a data table and search by either header from there

Thanks it worked !

Also if i want metric but by a query in elasticsearch , how would i go about it.

I tried following query but it's throwing an error.

GET /index/table/_search/
{
"sort": [
{
"x1": {"order" : "asc"}
}
],
"query": {
"term": { "id" }
},
}

Thanks in advance

All aggregations and sorting are configured via the visual builder in the UI. The search bar can accept query DSL for the purposes of filtering the documents, but only the query/filter part of the DSL.

Check out this thread for such an example: Where to add a missing filter in this Kibana search

Thanks. Currently i want to port either the dashboard completely to my website or get the metric table data from the elasticsearch via query , aggregation (I am not sure which needs to be used), so i can use it.

Thanks again for the patience and help. :blush: