-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty index corrupts sort order #8226
Comments
I can reproduce this on public void testIssue8226() {
int numIndices = between(5, 10);
for (int i = 0; i < numIndices; i++) {
assertAcked(prepareCreate("test_" + i).addAlias(new Alias("test")));
if (i > 0) {
client().prepareIndex("test_" + i, "foo", "" + i).setSource("{\"entry\": " + i + "}").get();
}
}
ensureYellow();
refresh();
SearchResponse searchResponse = client().prepareSearch()
.addSort(new FieldSortBuilder("entry").order(SortOrder.DESC).ignoreUnmapped(true))
.setSize(10).get();
assertSearchResponse(searchResponse);
for (int j = 1; j < searchResponse.getHits().hits().length; j++) {
assertThat(searchResponse.toString(), searchResponse.getHits().hits()[j].getId(), lessThan(searchResponse.getHits().hits()[j-1].getId()));
}
} |
It seems this doesn't happen in |
alright I found the issue - nasty... will open a PR soon |
I believe it is because this change #7039 is only on 1.4+ |
fixed in |
I've been trying to track down some strange sorting results and have narrowed it down to having an empty index. I have multiple indexes all aliased to the same value. Sort order works fine, but once you add an empty index, the order is corrupted. Reproduction below:
Results:
I can fix sort order in two ways: 1) remove the empty index or 2) change "ignore_unmapped" to false.
But IMO an empty index should no affect sort results. I'm also confused on why "ignore_unmapped": false, fixes things. I would think you would want the reverse, but it fails when true.
The text was updated successfully, but these errors were encountered: