|
26 | 26 | import org.elasticsearch.core.UpdateForV9; |
27 | 27 | import org.elasticsearch.rest.RestStatus; |
28 | 28 | import org.elasticsearch.rest.action.search.RestSearchAction; |
29 | | -import org.elasticsearch.test.MapMatcher; |
30 | 29 | import org.elasticsearch.test.StreamsUtils; |
31 | 30 | import org.elasticsearch.test.rest.ESRestTestCase; |
32 | 31 | import org.elasticsearch.test.rest.RestTestLegacyFeatures; |
|
53 | 52 | import java.util.stream.Collectors; |
54 | 53 |
|
55 | 54 | import static org.elasticsearch.core.TimeValue.timeValueSeconds; |
56 | | -import static org.elasticsearch.test.MapMatcher.assertMap; |
57 | | -import static org.elasticsearch.test.MapMatcher.matchesMap; |
58 | 55 | import static org.elasticsearch.upgrades.FullClusterRestartIT.assertNumHits; |
59 | 56 | import static org.hamcrest.Matchers.anyOf; |
60 | 57 | import static org.hamcrest.Matchers.containsString; |
@@ -965,82 +962,6 @@ public void testDataStreams() throws Exception { |
965 | 962 | assertNumHits("ds", 1, 1); |
966 | 963 | } |
967 | 964 |
|
968 | | - /** |
969 | | - * Tests that a single document survives. Super basic smoke test. |
970 | | - */ |
971 | | - @UpdateForV9(owner = UpdateForV9.Owner.SEARCH_FOUNDATIONS) // Can be removed |
972 | | - public void testDisableFieldNameField() throws IOException { |
973 | | - assumeFalse( |
974 | | - "can only disable field names field before 8.0", |
975 | | - oldClusterHasFeature(RestTestLegacyFeatures.DISABLE_FIELD_NAMES_FIELD_REMOVED) |
976 | | - ); |
977 | | - |
978 | | - String docLocation = "/nofnf/_doc/1"; |
979 | | - String doc = """ |
980 | | - { |
981 | | - "dv": "test", |
982 | | - "no_dv": "test" |
983 | | - }"""; |
984 | | - |
985 | | - if (isRunningAgainstOldCluster()) { |
986 | | - Request createIndex = new Request("PUT", "/nofnf"); |
987 | | - createIndex.setJsonEntity(""" |
988 | | - { |
989 | | - "settings": { |
990 | | - "index": { |
991 | | - "number_of_replicas": 1 |
992 | | - } |
993 | | - }, |
994 | | - "mappings": { |
995 | | - "_field_names": { "enabled": false }, |
996 | | - "properties": { |
997 | | - "dv": { "type": "keyword" }, |
998 | | - "no_dv": { "type": "keyword", "doc_values": false } |
999 | | - } |
1000 | | - } |
1001 | | - }"""); |
1002 | | - createIndex.setOptions(RequestOptions.DEFAULT.toBuilder().setWarningsHandler(fieldNamesFieldOk())); |
1003 | | - client().performRequest(createIndex); |
1004 | | - |
1005 | | - Request createDoc = new Request("PUT", docLocation); |
1006 | | - createDoc.addParameter("refresh", "true"); |
1007 | | - createDoc.setJsonEntity(doc); |
1008 | | - client().performRequest(createDoc); |
1009 | | - } |
1010 | | - |
1011 | | - Request getRequest = new Request("GET", docLocation); |
1012 | | - assertThat(toStr(client().performRequest(getRequest)), containsString(doc)); |
1013 | | - |
1014 | | - if (isRunningAgainstOldCluster() == false) { |
1015 | | - Request esql = new Request("POST", "_query"); |
1016 | | - esql.setJsonEntity(""" |
1017 | | - { |
1018 | | - "query": "FROM nofnf | LIMIT 1" |
1019 | | - }"""); |
1020 | | - // {"columns":[{"name":"dv","type":"keyword"},{"name":"no_dv","type":"keyword"}],"values":[["test",null]]} |
1021 | | - try { |
1022 | | - Map<String, Object> result = entityAsMap(client().performRequest(esql)); |
1023 | | - MapMatcher mapMatcher = matchesMap(); |
1024 | | - if (result.get("took") != null) { |
1025 | | - mapMatcher = mapMatcher.entry("took", ((Integer) result.get("took")).intValue()); |
1026 | | - } |
1027 | | - assertMap( |
1028 | | - result, |
1029 | | - mapMatcher.entry( |
1030 | | - "columns", |
1031 | | - List.of(Map.of("name", "dv", "type", "keyword"), Map.of("name", "no_dv", "type", "keyword")) |
1032 | | - ).entry("values", List.of(List.of("test", "test"))) |
1033 | | - ); |
1034 | | - } catch (ResponseException e) { |
1035 | | - logger.error( |
1036 | | - "failed to query index without field name field. Existing indices:\n{}", |
1037 | | - EntityUtils.toString(client().performRequest(new Request("GET", "_cat/indices")).getEntity()) |
1038 | | - ); |
1039 | | - throw e; |
1040 | | - } |
1041 | | - } |
1042 | | - } |
1043 | | - |
1044 | 965 | /** |
1045 | 966 | * Ignore the warning about the {@code _field_names} field. We intentionally |
1046 | 967 | * turn that field off sometimes. And other times old versions spuriously |
|
0 commit comments