This might be a silly question but I could not manage to filter elasticsearch indexes by a datetime field. I must be missing something.
This is the mapping:
"created_at": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
This is what I got:
{
"_index": "myindex",
"_type": "myindextype",
"_id": "21c",
"_score": 1,
"_source": {
"code": "21c",
"name": "hello",
...
"created_at": "2015-04-30T13:10:50.107769Z"
}
},
With this query:
"query": {
"filtered": {
"query": {},
"filter": {
"range": {
"created_at": {
"gte": "2015-05-02T13:10:50.107769Z"
"format": "strict_date_optional_time||epoch_millis"
}}}}}
I would expect to filter out the entry above. But it returns nothing.
Is there a problem with time format? Because it is directly coming from Django Rest Framework's serializers. They claim that it is ISO 8601 format and elasticsearch claims the same.
I would also like to filter them out by a simpler date like "2015-05-02".
I am stuck. Thank you in advance.
Edit: It does not matter whatever i write into the range filter. It always return all the entries.