Hi,
I've tried a lot of different things and I'm almost giving up. I just cannot make date range queries work. I'm using parent-child mapping.
This is my mapping: https://gist.github.com/hgfischer/2fcdc3ed83cfb4b56e3f7afc34337633
The relevant part of the mapping is:
{
"date_template": {
"match": "*_date",
"mapping": {
"type": "date"
}
}
},
I'm storing documents with fields like:
"timeuuid_date": 1473178784273,
"timestamp_date": "2016-09-07T05:49:54.706Z",
And I'm trying queries with date ranges:
POST /index-name/parent-type
{
"timeout": "60s",
"query": {
"bool": {
"must": [
{
"has_child": {
"type": "event",
"min_children": 2,
"inner_hits": {},
"query": {
"bool": {
"must": [
{
"match": {
"attribute": "some value"
}
}
]
}
}
}
},
{
"range": {
"timeuuid_date": {
"lte": "now-2d"
}
}
}
]
}
}
}
And I get no results. If I remove the date range part, I get results.
I've checked the index mapping, and it looks correct:
GET /index-name
...
"timestamp_date": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"timeuuid_date": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
...
What am I doing wrong?