Query
{
"size": 20,
"query": {
"match_all": {}
},
"_source": ["INBOUND_CALL_mod_date", "OUTBOUND_CALL_mod_date"],
"sort": [
{
"INBOUND_CALL_mod_date": {
"order": "desc"
}
},
{
"OUTBOUND_CALL_mod_date": {
"order": "desc"
}
}
],
"track_total_hits": true
}
Response JSON
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 20,
"relation" : "eq"
},
"max_score" : null,
"hits" : [
{
"_index" : "multi-sort-test-index",
"_type" : "_doc",
"_id" : "17",
"_score" : null,
"_source" : {
"INBOUND_CALL_mod_date" : "2021-11-09T11:44:23.823+0000"
},
"sort" : [
1636458263823,
-9223372036854775808
]
},
{
"_index" : "multi-sort-test-index",
"_type" : "_doc",
"_id" : "18",
"_score" : null,
"_source" : {
"INBOUND_CALL_mod_date" : "2021-11-02T13:44:13.654+0000"
},
"sort" : [
1635860653654,
-9223372036854775808
]
},
{
"_index" : "multi-sort-test-index",
"_type" : "_doc",
"_id" : "19",
"_score" : null,
"_source" : {
"INBOUND_CALL_mod_date" : "2021-10-29T13:22:27.917+0000"
},
"sort" : [
1635513747917,
-9223372036854775808
]
},
{
"_index" : "multi-sort-test-index",
"_type" : "_doc",
"_id" : "20",
"_score" : null,
"_source" : {
"INBOUND_CALL_mod_date" : "2021-10-29T13:17:56.599+0000"
},
"sort" : [
1635513476599,
-9223372036854775808
]
},
{
"_index" : "multi-sort-test-index",
"_type" : "_doc",
"_id" : "2",
"_score" : null,
"_source" : {
"OUTBOUND_CALL_mod_date" : "2021-11-09T12:57:34.752+0000"
},
"sort" : [
-9223372036854775808,
1636462654752
]
},
{
"_index" : "multi-sort-test-index",
"_type" : "_doc",
"_id" : "3",
"_score" : null,
"_source" : {
"OUTBOUND_CALL_mod_date" : "2021-11-09T12:51:38.292+0000"
},
"sort" : [
-9223372036854775808,
1636462298292
]
}
]
}
}
As per the response below is the sorted list by two date fields with recent most date.
But shouldn't the nov 09 documents highlighted in 5 and 6 position appear on 1 and 2 position respectively?
Thanks in advance.