|
41 | 41 | import org.elasticsearch.test.ESSingleNodeTestCase;
|
42 | 42 | import org.elasticsearch.test.IndexSettingsModule;
|
43 | 43 |
|
| 44 | +import java.io.IOException; |
| 45 | +import java.util.Collection; |
44 | 46 | import java.util.Collections;
|
45 | 47 | import java.util.HashSet;
|
46 | 48 | import java.util.Set;
|
@@ -171,4 +173,24 @@ public void testPost2Dot0EagerLoading() {
|
171 | 173 | private static Settings post2Dot0IndexSettings() {
|
172 | 174 | return Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_2_1_0).build();
|
173 | 175 | }
|
| 176 | + |
| 177 | + public void testUpdateEagerGlobalOrds() throws IOException { |
| 178 | + String parentMapping = XContentFactory.jsonBuilder().startObject().startObject("parent_type") |
| 179 | + .endObject().endObject().string(); |
| 180 | + String childMapping = XContentFactory.jsonBuilder().startObject().startObject("child_type") |
| 181 | + .startObject("_parent").field("type", "parent_type").endObject() |
| 182 | + .endObject().endObject().string(); |
| 183 | + IndexService indexService = createIndex("test", Settings.builder().put("index.version.created", Version.V_5_6_0).build()); |
| 184 | + indexService.mapperService().merge("parent_type", new CompressedXContent(parentMapping), MergeReason.MAPPING_UPDATE, false); |
| 185 | + indexService.mapperService().merge("child_type", new CompressedXContent(childMapping), MergeReason.MAPPING_UPDATE, false); |
| 186 | + |
| 187 | + assertTrue(indexService.mapperService().documentMapper("child_type").parentFieldMapper().fieldType().eagerGlobalOrdinals()); |
| 188 | + |
| 189 | + String childMappingUpdate = XContentFactory.jsonBuilder().startObject().startObject("child_type") |
| 190 | + .startObject("_parent").field("type", "parent_type").field("eager_global_ordinals", false).endObject() |
| 191 | + .endObject().endObject().string(); |
| 192 | + indexService.mapperService().merge("child_type", new CompressedXContent(childMappingUpdate), MergeReason.MAPPING_UPDATE, false); |
| 193 | + |
| 194 | + assertFalse(indexService.mapperService().documentMapper("child_type").parentFieldMapper().fieldType().eagerGlobalOrdinals()); |
| 195 | + } |
174 | 196 | }
|
0 commit comments