summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch/search/nested
diff options
context:
space:
mode:
authorMartijn van Groningen <martijn.v.groningen@gmail.com>2017-06-09 12:48:41 +0200
committerMartijn van Groningen <martijn.v.groningen@gmail.com>2017-06-09 14:57:11 +0200
commitc7ae27d57f1ddea0841c5a484a34e9765ce9f014 (patch)
tree760c62e580f0a6601b692395cbeb36b3bad8da5e /core/src/test/java/org/elasticsearch/search/nested
parent87d19b21c7515352f7dce4097aca88033130cc79 (diff)
nested: In case of a single type the _id field should be added to the nested document instead of _uid field.
When `index.mapping.single_type` is `true` the `_uid` field is not used and instead `_id` field is used. Prior to this change nested documents would in this case still use the `_uid` field to mark to what root document they belong to. In case of deleting documents this could lead to only the root Lucene document to be deleted and not the nested Lucene documents. This broke the docid block ordering the block join relies on in order to work correctly and thus causing the `nested` query, `nested` aggregation, nested sorting and nested inner hits to either fail or yield incorrect results. This bug only manifests in 6.0.0-ALPHA2 release and snaphots (5.5.0-SNAPSHOT, 5.6.0-SNAPSHOT, 6.0.0-SNAPSHOT).
Diffstat (limited to 'core/src/test/java/org/elasticsearch/search/nested')
-rw-r--r--core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java8
1 files changed, 1 insertions, 7 deletions
diff --git a/core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java b/core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java
index 316e83ad1b..3e4792690a 100644
--- a/core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java
+++ b/core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java
@@ -57,9 +57,7 @@ import static org.hamcrest.Matchers.startsWith;
public class SimpleNestedIT extends ESIntegTestCase {
public void testSimpleNested() throws Exception {
assertAcked(prepareCreate("test")
- .setSettings("index.mapping.single_type", false)
- .addMapping("type1", "nested1", "type=nested")
- .addMapping("type2", "nested1", "type=nested"));
+ .addMapping("type1", "nested1", "type=nested"));
ensureGreen();
// check on no data, see it works
@@ -158,10 +156,6 @@ public class SimpleNestedIT extends ESIntegTestCase {
searchResponse = client().prepareSearch("test").setQuery(nestedQuery("nested1", termQuery("nested1.n_field1", "n_value1_1"), ScoreMode.Avg)).execute().actionGet();
assertNoFailures(searchResponse);
assertThat(searchResponse.getHits().getTotalHits(), equalTo(1L));
-
- searchResponse = client().prepareSearch("test").setTypes("type1", "type2").setQuery(nestedQuery("nested1", termQuery("nested1.n_field1", "n_value1_1"), ScoreMode.Avg)).execute().actionGet();
- assertNoFailures(searchResponse);
- assertThat(searchResponse.getHits().getTotalHits(), equalTo(1L));
}
public void testMultiNested() throws Exception {