My mapping:
{
"id": {
"type": "long"
},
"type": {
"type": "keyword",
"ignore_above": 32766
},
"text": {
"type": "text"
},
"image":{
"type": "text"
},
"slug": {
"type": "text"
},
"date": {
"type": "date",
"format": "strict_date"
}
}
My query:
{
"sort":[
"_score",
{"date":{"order":"asc"}}
],
"query": {
"match_phrase" : { "text" : "terminal 5" }
}
}
My results: (Check lines tagged with WRONG)
"hits" : [
{
"_index" : "global_search",
"_type" : "_doc",
"_id" : "10295",
"_score" : 19.130016,
"_source" : {
"id" : 10295,
"type" : "venue",
"text" : "Terminal 5", #This is fine, I expect it to appear first
"weight" : 1,
"image" : null,
"slug" : "terminal-5",
"date" : null
},
"sort" : [
19.130016,
9223372036854775807
]
},
{
"_index" : "global_search",
"_type" : "_doc",
"_id" : "102718",
"_score" : 14.129013,
"_source" : {
"id" : 705718,
"type" : "event",
"text" : "Kcon at Terminal 5, New York",
"weight" : 2,
"image" : null,
"slug" : "09-01-2022-kcon-new-york-ny/",
"date" : "2022-09-01" #Seems ok
},
"sort" : [
14.129013,
1661990400000
]
},
{
"_index" : "global_search",
"_type" : "_doc",
"_id" : "693747",
"_score" : 14.129013,
"_source" : {
"id" : 693747,
"type" : "event",
"text" : "Dayglow at Terminal 5, New York",
"weight" : 2,
"image" : null,
"slug" : "11-17-2022-dayglow-new-york-ny",
"date" : "2022-11-17" #WRONG should appear after the next record
},
"sort" : [
14.129013,
1668643200000
]
},
{
"_index" : "global_search",
"_type" : "_doc",
"_id" : "185824",
"_score" : 13.957819,
"_source" : {
"id" : 685844,
"type" : "event",
"text" : "311 at Terminal 5, New York",
"weight" : 2,
"image" : null,
"slug" : "10-01-2022-311-new-york-ny/",
"date" : "2022-10-01" # WRONG I would expect this result to come up first
},
"sort" : [
13.957819,
1664582400000
]
}