Angelos
(Angelos)
July 26, 2018, 2:14pm
1
Hello!
I want to sort a field that happens to be a string. but the actual value of that string is date.
Is there any way to convert this field to date?
GET /index/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"product": "blah"
}
}
]
}
},
"sort": {
"string_date": {
"order": "desc"
}
}
}
Thank you!
/Angelos
dadoonet
(David Pilato)
July 26, 2018, 2:27pm
2
Use a date datatype in your mapping.
Angelos
(Angelos)
July 26, 2018, 2:44pm
3
Can I update the datatype?
For example from:
"string_date": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 100
}
to:
"string_date": {
"type": "date"
}
system
(system)
Closed
August 23, 2018, 3:06pm
5
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.