Hi all,
I am using java to build up a search expression based on user inputs. It seems to work until I intersect a boolean query, filter and geodistance query. The very strange part is that searchResponse.getHits().getHits() is empty, yet searchResponse.getTotalRecords() is 1, which is expected.
Edit: I just ran the last query that returns no results from the command line using curl, and it returns 1 result as expected.
Much more detail here.
ElasticSearch version 2.3.2 server
ElasticSearch Java Library 2.3.1, and 2.3.3 tested, same results
First I filter by user:
"query" : {
"query_string" : {
"query" : "OwnerId:(3694)"
}
},
This works as expected, and returns many results.
Then I add a query string:
"query" : {
"bool" : {
"must" : {
"query_string" : {
"query" : "Summary:(\"business analyst\" AND qa)"
}
},
"filter" : {
"query_string" : {
"query" : "OwnerId:(3694)"
}
}
}
},
This correctly returns exactly one result.
I remove the query, and add a GeoDistance search.
"query" : {
"bool" : {
"filter" : [ {
"query_string" : {
"query" : "OwnerId:(3694)"
}
}, {
"geo_distance" : {
"Latlong" : [ -71.608545, 42.860306 ],
"distance" : "30.0mi",
"optimize_bbox" : "memory"
}
} ]
}
},
This returns four results, including the result from the previous query.
Add the query string back in.
"query" : {
"bool" : {
"must" : {
"query_string" : {
"query" : "Summary:(\"business analyst\" AND qa)"
}
},
"filter" : {
"bool" : {
"filter" : [ {
"query_string" : {
"query" : "OwnerId:(3694)"
}
}, {
"geo_distance" : {
"Latlong" : [ -71.608545, 42.860306 ],
"distance" : "30.0mi",
"optimize_bbox" : "memory"
}
} ]
}
}
}
},
And now I get no results, searchResult.getHits().getHits() is empty, but the searchResult object claims there is 1 total record.
If anyone has any suggestions on what I should try next, I'd certainly appreciate them.
Thanks in advance
Tony