I am trying to compare hours using painless language in my elasticsearch query. I would like query something like:
{
"script":"doc['schedule.from_time'] >= doc['schedule.to_time']"
}
But I have the error:
Cannot apply [>] operation to types [org.elasticsearch.index.fielddata.ScriptDocValues.Dates]
The scheme of the nested document is:
{
"settings": {
"index.mapping.total_fields.limit": 10000
},
"mappings": {
"_doc": {
"dynamic_templates": [{
"integers": {
"match_mapping_type": "long",
"mapping": {
"type": "long",
"index": false
}
}
}],
"properties": {
"enabled_services": {
"type": "nested",
"properties": {
"service_id": {
"type": "text",
"analyzer": "whitespace",
"search_analyzer": "whitespace"
},
"available_day_of_week": {
"type": "long"
},
"available_from_time": {
"type": "date",
"format": "hour_minute"
},
"available_to_time": {
"type": "date",
"format": "hour_minute"
}
}
}
}
}
}
}
(The values are formated like "2:00" or "18:00").
I have tried to use .date
or .value
but it does not work because my variable contains only hours not datetime.
Can someone help me :)