|
41 | 41 | import org.elasticsearch.test.IndexSettingsModule;
|
42 | 42 | import org.elasticsearch.test.InternalSettingsPlugin;
|
43 | 43 |
|
| 44 | +import java.io.IOException; |
44 | 45 | import java.util.Collection;
|
45 | 46 | import java.util.Collections;
|
46 | 47 | import java.util.HashSet;
|
@@ -138,4 +139,23 @@ private static int getNumberOfFieldWithParentPrefix(ParseContext.Document doc) {
|
138 | 139 | return numFieldWithParentPrefix;
|
139 | 140 | }
|
140 | 141 |
|
| 142 | + public void testUpdateEagerGlobalOrds() throws IOException { |
| 143 | + String parentMapping = XContentFactory.jsonBuilder().startObject().startObject("parent_type") |
| 144 | + .endObject().endObject().string(); |
| 145 | + String childMapping = XContentFactory.jsonBuilder().startObject().startObject("child_type") |
| 146 | + .startObject("_parent").field("type", "parent_type").endObject() |
| 147 | + .endObject().endObject().string(); |
| 148 | + IndexService indexService = createIndex("test", Settings.builder().put("index.version.created", Version.V_5_6_0).build()); |
| 149 | + indexService.mapperService().merge("parent_type", new CompressedXContent(parentMapping), MergeReason.MAPPING_UPDATE, false); |
| 150 | + indexService.mapperService().merge("child_type", new CompressedXContent(childMapping), MergeReason.MAPPING_UPDATE, false); |
| 151 | + |
| 152 | + assertTrue(indexService.mapperService().documentMapper("child_type").parentFieldMapper().fieldType().eagerGlobalOrdinals()); |
| 153 | + |
| 154 | + String childMappingUpdate = XContentFactory.jsonBuilder().startObject().startObject("child_type") |
| 155 | + .startObject("_parent").field("type", "parent_type").field("eager_global_ordinals", false).endObject() |
| 156 | + .endObject().endObject().string(); |
| 157 | + indexService.mapperService().merge("child_type", new CompressedXContent(childMappingUpdate), MergeReason.MAPPING_UPDATE, false); |
| 158 | + |
| 159 | + assertFalse(indexService.mapperService().documentMapper("child_type").parentFieldMapper().fieldType().eagerGlobalOrdinals()); |
| 160 | + } |
141 | 161 | }
|
0 commit comments