Hi All,
Trying to add sort option in query while retriving the data from Elasticsearch.
Have been getting the below error
PHP Fatal error: Uncaught Elastic\Elasticsearch\Exception\ClientResponseException: 400 Bad Request: {"error":{"root_cause":[{"type":"parsing_exception","reason":"request does not support [sort]","line":1,"col":186}],"type":"parsing_exception","reason":"request does not support [sort]","line":1,"col":186},"status":400} .
But the sort option works well in kibana dev tools. Is there any issue with the library?
Below is the query which i am trying
{
"index": "indexname",
"search_type": "dfs_query_then_fetch",
"track_total_hits": true,
"body": {
"query": {
"bool": {
"must": [
{
"range": {
"amount": [
{
"lte": 1500000
}
]
}
}
],
"should": [],
"must_not": [],
"filter": []
}
},
"from": 0,
"size": 100,
"sort": {
"name": {
"order": "asc"
}
}
}
}