I am new to Elasticsearch and trying to update a project built on ES 1.3.1 to use 1.7.2. The project performs multiple steps, indexing in one step ("Step 1") and then querying using aggregations in the next step ("Step 2"). There is some code that attempts to flush in between. Using 1.3.1, this process works, but using 1.7.2, it fails. If I try to run the query from Step 2 outside my Java code (via curl), I still get nothing. However, if I shutdown and restart ES and then run it again, I do get results. Even before a restart if I run a "simple" Date Histogram aggregation on the new data I do get results. That query looks like this:
{
"size" : 0,
"aggs" : {
"date_aggregate" : {
"date_histogram" : {
"field" : "event_timestamp",
"interval" : "day"
}
}
}
}
The query that does not return results until an ES restart looks like this:
{
"size" : 0,
"aggregations" : {
"data_source" : {
"filter" : {
"bool" : {
"must" : [ {
"range" : {
"event_timestamp" : {
"from" : "2015-05-15 00:18:54",
"to" : "2015-09-11 23:51:36",
"include_lower" : true,
"include_upper" : false
}
}
}, {
"term" : {
"data_source" : "Foo"
}
} ]
}
},
"aggregations" : {
"aoi_id_aggregate" : {
"terms" : {
"field" : "aoi_id",
"size" : 0
},
"aggregations" : {
"date_aggregate" : {
"date_histogram" : {
"field" : "event_timestamp",
"interval" : "day",
"order" : {
"_key" : "desc"
}
}
}
}
}
}
}
}
}
I have tried to refresh, sync, and flush the index in between, but to no avail. Please help me find the appropriate way to do this.