[Remove] type from CIR.mapping and CIRB.mapping (#2478)
First pass to remove types from CreateIndexRequest and CreateIndexRequestBuilder mapping method. This method is overloaded several times so the most widely used methods in the RequestBuilder are refactored from mapping to setMapping to avoid confusion, conflicts, and to be consistent with other method names (e.g., setSettings, setCause, setAlias). Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
This commit is contained in:
parent
05a5819243
commit
3675400b92
|
@ -70,10 +70,8 @@ public class HighlighterWithAnalyzersTests extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testNgramHighlightingWithBrokenPositions() throws IOException {
|
public void testNgramHighlightingWithBrokenPositions() throws IOException {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"test",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("test")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("name")
|
.startObject("name")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -88,7 +86,6 @@ public class HighlighterWithAnalyzersTests extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
.setSettings(
|
.setSettings(
|
||||||
Settings.builder()
|
Settings.builder()
|
||||||
|
@ -260,7 +257,7 @@ public class HighlighterWithAnalyzersTests extends OpenSearchIntegTestCase {
|
||||||
.put("index.analysis.filter.synonym.type", "synonym")
|
.put("index.analysis.filter.synonym.type", "synonym")
|
||||||
.putList("index.analysis.filter.synonym.synonyms", "quick => fast");
|
.putList("index.analysis.filter.synonym.synonyms", "quick => fast");
|
||||||
|
|
||||||
assertAcked(prepareCreate("first_test_index").setSettings(builder.build()).addMapping("type1", type1TermVectorMapping()));
|
assertAcked(prepareCreate("first_test_index").setSettings(builder.build()).setMapping(type1TermVectorMapping()));
|
||||||
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
|
@ -421,7 +418,6 @@ public class HighlighterWithAnalyzersTests extends OpenSearchIntegTestCase {
|
||||||
public static XContentBuilder type1TermVectorMapping() throws IOException {
|
public static XContentBuilder type1TermVectorMapping() throws IOException {
|
||||||
return XContentFactory.jsonBuilder()
|
return XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -432,7 +428,6 @@ public class HighlighterWithAnalyzersTests extends OpenSearchIntegTestCase {
|
||||||
.field("term_vector", "with_positions_offsets")
|
.field("term_vector", "with_positions_offsets")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -641,12 +641,11 @@ public class MoreExpressionIT extends OpenSearchIntegTestCase {
|
||||||
public void testGeo() throws Exception {
|
public void testGeo() throws Exception {
|
||||||
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("location")
|
.startObject("location")
|
||||||
.field("type", "geo_point");
|
.field("type", "geo_point");
|
||||||
xContentBuilder.endObject().endObject().endObject().endObject();
|
xContentBuilder.endObject().endObject().endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", xContentBuilder));
|
assertAcked(prepareCreate("test").setMapping(xContentBuilder));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
.setId("1")
|
.setId("1")
|
||||||
|
@ -687,12 +686,11 @@ public class MoreExpressionIT extends OpenSearchIntegTestCase {
|
||||||
public void testBoolean() throws Exception {
|
public void testBoolean() throws Exception {
|
||||||
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("doc")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("vip")
|
.startObject("vip")
|
||||||
.field("type", "boolean");
|
.field("type", "boolean");
|
||||||
xContentBuilder.endObject().endObject().endObject().endObject();
|
xContentBuilder.endObject().endObject().endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("doc", xContentBuilder));
|
assertAcked(prepareCreate("test").setMapping(xContentBuilder));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
indexRandom(
|
indexRandom(
|
||||||
true,
|
true,
|
||||||
|
|
|
@ -128,10 +128,8 @@ public class TokenCountFieldMapperIntegrationIT extends OpenSearchIntegTestCase
|
||||||
settings.put("index.analysis.analyzer.mock_english.tokenizer", "standard");
|
settings.put("index.analysis.analyzer.mock_english.tokenizer", "standard");
|
||||||
settings.put("index.analysis.analyzer.mock_english.filter", "stop");
|
settings.put("index.analysis.analyzer.mock_english.filter", "stop");
|
||||||
prepareCreate("test").setSettings(settings)
|
prepareCreate("test").setSettings(settings)
|
||||||
.addMapping(
|
.setMapping(
|
||||||
"test",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("test")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("foo")
|
.startObject("foo")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -162,7 +160,6 @@ public class TokenCountFieldMapperIntegrationIT extends OpenSearchIntegTestCase
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
|
@ -55,8 +55,7 @@ public abstract class AbstractParentChildTestCase extends ParentChildTestCase {
|
||||||
@Before
|
@Before
|
||||||
public void setupCluster() throws Exception {
|
public void setupCluster() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"doc",
|
|
||||||
addFieldMappings(
|
addFieldMappings(
|
||||||
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "article", "comment"),
|
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "article", "comment"),
|
||||||
"commenter",
|
"commenter",
|
||||||
|
|
|
@ -174,8 +174,7 @@ public class ChildrenIT extends AbstractParentChildTestCase {
|
||||||
public void testWithDeletes() throws Exception {
|
public void testWithDeletes() throws Exception {
|
||||||
String indexName = "xyz";
|
String indexName = "xyz";
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate(indexName).addMapping(
|
prepareCreate(indexName).setMapping(
|
||||||
"doc",
|
|
||||||
addFieldMappings(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"), "name", "keyword")
|
addFieldMappings(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"), "name", "keyword")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -234,8 +233,7 @@ public class ChildrenIT extends AbstractParentChildTestCase {
|
||||||
prepareCreate(indexName).setSettings(
|
prepareCreate(indexName).setSettings(
|
||||||
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||||
)
|
)
|
||||||
.addMapping(
|
.setMapping(
|
||||||
"doc",
|
|
||||||
addFieldMappings(
|
addFieldMappings(
|
||||||
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, masterType, childType),
|
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, masterType, childType),
|
||||||
"brand",
|
"brand",
|
||||||
|
@ -309,8 +307,7 @@ public class ChildrenIT extends AbstractParentChildTestCase {
|
||||||
String parentType = "country";
|
String parentType = "country";
|
||||||
String childType = "city";
|
String childType = "city";
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate(indexName).addMapping(
|
prepareCreate(indexName).setMapping(
|
||||||
"doc",
|
|
||||||
addFieldMappings(
|
addFieldMappings(
|
||||||
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, grandParentType, parentType, parentType, childType),
|
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, grandParentType, parentType, parentType, childType),
|
||||||
"name",
|
"name",
|
||||||
|
@ -352,8 +349,7 @@ public class ChildrenIT extends AbstractParentChildTestCase {
|
||||||
// Before we only evaluated segments that yielded matches in 'towns' and 'parent_names' aggs, which caused
|
// Before we only evaluated segments that yielded matches in 'towns' and 'parent_names' aggs, which caused
|
||||||
// us to miss to evaluate child docs in segments we didn't have parent matches for.
|
// us to miss to evaluate child docs in segments we didn't have parent matches for.
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("index").addMapping(
|
prepareCreate("index").setMapping(
|
||||||
"doc",
|
|
||||||
addFieldMappings(
|
addFieldMappings(
|
||||||
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parentType", "childType"),
|
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parentType", "childType"),
|
||||||
"name",
|
"name",
|
||||||
|
|
|
@ -102,8 +102,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testMultiLevelChild() throws Exception {
|
public void testMultiLevelChild() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"doc",
|
|
||||||
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child", "child", "grandchild")
|
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child", "child", "grandchild")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -166,9 +165,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
|
|
||||||
// see #2744
|
// see #2744
|
||||||
public void test2744() throws IOException {
|
public void test2744() throws IOException {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "foo", "test")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "foo", "test"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
// index simple data
|
// index simple data
|
||||||
|
@ -185,9 +182,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSimpleChildQuery() throws Exception {
|
public void testSimpleChildQuery() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
// index simple data
|
// index simple data
|
||||||
|
@ -251,9 +246,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
|
|
||||||
// Issue #3290
|
// Issue #3290
|
||||||
public void testCachingBugWithFqueryFilter() throws Exception {
|
public void testCachingBugWithFqueryFilter() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||||
// index simple data
|
// index simple data
|
||||||
|
@ -290,9 +283,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHasParentFilter() throws Exception {
|
public void testHasParentFilter() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
Map<String, Set<String>> parentToChildren = new HashMap<>();
|
Map<String, Set<String>> parentToChildren = new HashMap<>();
|
||||||
// Childless parent
|
// Childless parent
|
||||||
|
@ -340,9 +331,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSimpleChildQueryWithFlush() throws Exception {
|
public void testSimpleChildQueryWithFlush() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
// index simple data with flushes, so we have many segments
|
// index simple data with flushes, so we have many segments
|
||||||
|
@ -408,8 +397,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testScopedFacet() throws Exception {
|
public void testScopedFacet() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"doc",
|
|
||||||
addFieldMappings(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"), "c_field", "keyword")
|
addFieldMappings(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"), "c_field", "keyword")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -459,9 +447,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDeletedParent() throws Exception {
|
public void testDeletedParent() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
// index simple data
|
// index simple data
|
||||||
createIndexRequest("test", "parent", "p1", null, "p_field", "p_value1").get();
|
createIndexRequest("test", "parent", "p1", null, "p_field", "p_value1").get();
|
||||||
|
@ -496,9 +482,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDfsSearchType() throws Exception {
|
public void testDfsSearchType() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
// index simple data
|
// index simple data
|
||||||
|
@ -526,9 +510,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHasChildAndHasParentFailWhenSomeSegmentsDontContainAnyParentOrChildDocs() throws Exception {
|
public void testHasChildAndHasParentFailWhenSomeSegmentsDontContainAnyParentOrChildDocs() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
createIndexRequest("test", "parent", "1", null, "p_field", 1).get();
|
createIndexRequest("test", "parent", "1", null, "p_field", 1).get();
|
||||||
|
@ -551,9 +533,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCountApiUsage() throws Exception {
|
public void testCountApiUsage() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
String parentId = "p1";
|
String parentId = "p1";
|
||||||
|
@ -584,9 +564,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExplainUsage() throws Exception {
|
public void testExplainUsage() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
String parentId = "p1";
|
String parentId = "p1";
|
||||||
|
@ -650,10 +628,8 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testScoreForParentChildQueriesWithFunctionScore() throws Exception {
|
public void testScoreForParentChildQueriesWithFunctionScore() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"doc",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("doc")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("join_field")
|
.startObject("join_field")
|
||||||
.field("type", "join")
|
.field("type", "join")
|
||||||
|
@ -663,7 +639,6 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -758,9 +733,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
|
|
||||||
// Issue #2536
|
// Issue #2536
|
||||||
public void testParentChildQueriesCanHandleNoRelevantTypesInIndex() throws Exception {
|
public void testParentChildQueriesCanHandleNoRelevantTypesInIndex() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
SearchResponse response = client().prepareSearch("test")
|
SearchResponse response = client().prepareSearch("test")
|
||||||
|
@ -792,9 +765,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHasChildAndHasParentFilter_withFilter() throws Exception {
|
public void testHasChildAndHasParentFilter_withFilter() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
createIndexRequest("test", "parent", "1", null, "p_field", 1).get();
|
createIndexRequest("test", "parent", "1", null, "p_field", 1).get();
|
||||||
|
@ -820,9 +791,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHasChildInnerHitsHighlighting() throws Exception {
|
public void testHasChildInnerHitsHighlighting() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
createIndexRequest("test", "parent", "1", null, "p_field", 1).get();
|
createIndexRequest("test", "parent", "1", null, "p_field", 1).get();
|
||||||
|
@ -848,9 +817,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHasChildAndHasParentWrappedInAQueryFilter() throws Exception {
|
public void testHasChildAndHasParentWrappedInAQueryFilter() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
// query filter in case for p/c shouldn't execute per segment, but rather
|
// query filter in case for p/c shouldn't execute per segment, but rather
|
||||||
|
@ -884,8 +851,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testSimpleQueryRewrite() throws Exception {
|
public void testSimpleQueryRewrite() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"doc",
|
|
||||||
addFieldMappings(
|
addFieldMappings(
|
||||||
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"),
|
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"),
|
||||||
"c_field",
|
"c_field",
|
||||||
|
@ -945,9 +911,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
|
|
||||||
// Issue #3144
|
// Issue #3144
|
||||||
public void testReIndexingParentAndChildDocuments() throws Exception {
|
public void testReIndexingParentAndChildDocuments() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
// index simple data
|
// index simple data
|
||||||
|
@ -1004,9 +968,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
|
|
||||||
// Issue #3203
|
// Issue #3203
|
||||||
public void testHasChildQueryWithMinimumScore() throws Exception {
|
public void testHasChildQueryWithMinimumScore() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
// index simple data
|
// index simple data
|
||||||
|
@ -1031,7 +993,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
public void testParentFieldQuery() throws Exception {
|
public void testParentFieldQuery() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").setSettings(Settings.builder().put("index.refresh_interval", -1))
|
prepareCreate("test").setSettings(Settings.builder().put("index.refresh_interval", -1))
|
||||||
.addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
.setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
|
@ -1063,7 +1025,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
public void testParentIdQuery() throws Exception {
|
public void testParentIdQuery() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).put("index.refresh_interval", -1))
|
prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).put("index.refresh_interval", -1))
|
||||||
.addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
.setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
|
@ -1083,9 +1045,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHasChildNotBeingCached() throws IOException {
|
public void testHasChildNotBeingCached() throws IOException {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
// index simple data
|
// index simple data
|
||||||
|
@ -1146,10 +1106,8 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
// Issue #3818
|
// Issue #3818
|
||||||
public void testHasChildQueryOnlyReturnsSingleChildType() throws Exception {
|
public void testHasChildQueryOnlyReturnsSingleChildType() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("grandissue").addMapping(
|
prepareCreate("grandissue").setMapping(
|
||||||
"doc",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("doc")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("join_field")
|
.startObject("join_field")
|
||||||
.field("type", "join")
|
.field("type", "join")
|
||||||
|
@ -1160,7 +1118,6 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1203,8 +1160,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testHasChildQueryWithNestedInnerObjects() throws Exception {
|
public void testHasChildQueryWithNestedInnerObjects() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"doc",
|
|
||||||
addFieldMappings(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"), "objects", "nested")
|
addFieldMappings(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"), "objects", "nested")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -1282,9 +1238,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNamedFilters() throws Exception {
|
public void testNamedFilters() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
String parentId = "p1";
|
String parentId = "p1";
|
||||||
|
@ -1368,7 +1322,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
public void testParentChildCaching() throws Exception {
|
public void testParentChildCaching() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").setSettings(Settings.builder().put("index.refresh_interval", -1))
|
prepareCreate("test").setSettings(Settings.builder().put("index.refresh_interval", -1))
|
||||||
.addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
.setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
|
@ -1413,9 +1367,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testParentChildQueriesViaScrollApi() throws Exception {
|
public void testParentChildQueriesViaScrollApi() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
createIndexRequest("test", "parent", "p" + i, null).get();
|
createIndexRequest("test", "parent", "p" + i, null).get();
|
||||||
|
@ -1496,9 +1448,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMinMaxChildren() throws Exception {
|
public void testMinMaxChildren() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("test").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
indexRandom(true, createMinMaxDocBuilders().toArray(new IndexRequestBuilder[0]));
|
indexRandom(true, createMinMaxDocBuilders().toArray(new IndexRequestBuilder[0]));
|
||||||
|
@ -1811,10 +1761,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testHasParentInnerQueryType() {
|
public void testHasParentInnerQueryType() {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent-type", "child-type"))
|
||||||
"doc",
|
|
||||||
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent-type", "child-type")
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
createIndexRequest("test", "child-type", "child-id", "parent-id").get();
|
createIndexRequest("test", "child-type", "child-id", "parent-id").get();
|
||||||
createIndexRequest("test", "parent-type", "parent-id", null).get();
|
createIndexRequest("test", "parent-type", "parent-id", null).get();
|
||||||
|
@ -1834,8 +1781,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testHighlightersIgnoreParentChild() throws IOException {
|
public void testHighlightersIgnoreParentChild() throws IOException {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"doc",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("join_field")
|
.startObject("join_field")
|
||||||
|
@ -1888,7 +1834,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testAliasesFilterWithHasChildQuery() throws Exception {
|
public void testAliasesFilterWithHasChildQuery() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("my-index").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
prepareCreate("my-index").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
||||||
);
|
);
|
||||||
createIndexRequest("my-index", "parent", "1", null).get();
|
createIndexRequest("my-index", "parent", "1", null).get();
|
||||||
createIndexRequest("my-index", "child", "2", "1").get();
|
createIndexRequest("my-index", "child", "2", "1").get();
|
||||||
|
|
|
@ -103,10 +103,8 @@ public class InnerHitsIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testSimpleParentChild() throws Exception {
|
public void testSimpleParentChild() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("articles").addMapping(
|
prepareCreate("articles").setMapping(
|
||||||
"doc",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("doc")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("join_field")
|
.startObject("join_field")
|
||||||
.field("type", "join")
|
.field("type", "join")
|
||||||
|
@ -123,7 +121,6 @@ public class InnerHitsIT extends ParentChildTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -223,10 +220,8 @@ public class InnerHitsIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testRandomParentChild() throws Exception {
|
public void testRandomParentChild() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("idx").addMapping(
|
prepareCreate("idx").setMapping(
|
||||||
"doc",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("doc")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("id")
|
.startObject("id")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
|
@ -239,7 +234,6 @@ public class InnerHitsIT extends ParentChildTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
int numDocs = scaledRandomIntBetween(5, 50);
|
int numDocs = scaledRandomIntBetween(5, 50);
|
||||||
|
@ -323,8 +317,7 @@ public class InnerHitsIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testInnerHitsOnHasParent() throws Exception {
|
public void testInnerHitsOnHasParent() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("stack").addMapping(
|
prepareCreate("stack").setMapping(
|
||||||
"doc",
|
|
||||||
addFieldMappings(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "question", "answer"), "body", "text")
|
addFieldMappings(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "question", "answer"), "body", "text")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -379,8 +372,7 @@ public class InnerHitsIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testParentChildMultipleLayers() throws Exception {
|
public void testParentChildMultipleLayers() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("articles").addMapping(
|
prepareCreate("articles").setMapping(
|
||||||
"doc",
|
|
||||||
addFieldMappings(
|
addFieldMappings(
|
||||||
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "article", "comment", "comment", "remark"),
|
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "article", "comment", "comment", "remark"),
|
||||||
"title",
|
"title",
|
||||||
|
@ -449,8 +441,7 @@ public class InnerHitsIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testRoyals() throws Exception {
|
public void testRoyals() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("royals").addMapping(
|
prepareCreate("royals").setMapping(
|
||||||
"doc",
|
|
||||||
buildParentJoinFieldMappingFromSimplifiedDef(
|
buildParentJoinFieldMappingFromSimplifiedDef(
|
||||||
"join_field",
|
"join_field",
|
||||||
true,
|
true,
|
||||||
|
@ -536,9 +527,7 @@ public class InnerHitsIT extends ParentChildTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMatchesQueriesParentChildInnerHits() throws Exception {
|
public void testMatchesQueriesParentChildInnerHits() throws Exception {
|
||||||
assertAcked(
|
assertAcked(prepareCreate("index").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child")));
|
||||||
prepareCreate("index").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
|
||||||
);
|
|
||||||
List<IndexRequestBuilder> requests = new ArrayList<>();
|
List<IndexRequestBuilder> requests = new ArrayList<>();
|
||||||
requests.add(createIndexRequest("index", "parent", "1", null));
|
requests.add(createIndexRequest("index", "parent", "1", null));
|
||||||
requests.add(createIndexRequest("index", "child", "3", "1", "field", "value1"));
|
requests.add(createIndexRequest("index", "child", "3", "1", "field", "value1"));
|
||||||
|
@ -577,7 +566,7 @@ public class InnerHitsIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testUseMaxDocInsteadOfSize() throws Exception {
|
public void testUseMaxDocInsteadOfSize() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("index1").addMapping("doc", buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
prepareCreate("index1").setMapping(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"))
|
||||||
);
|
);
|
||||||
client().admin()
|
client().admin()
|
||||||
.indices()
|
.indices()
|
||||||
|
@ -599,8 +588,7 @@ public class InnerHitsIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testNestedInnerHitWrappedInParentChildInnerhit() {
|
public void testNestedInnerHitWrappedInParentChildInnerhit() {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"doc",
|
|
||||||
addFieldMappings(
|
addFieldMappings(
|
||||||
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent_type", "child_type"),
|
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent_type", "child_type"),
|
||||||
"nested_type",
|
"nested_type",
|
||||||
|
@ -632,8 +620,7 @@ public class InnerHitsIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testInnerHitsWithIgnoreUnmapped() {
|
public void testInnerHitsWithIgnoreUnmapped() {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("index1").addMapping(
|
prepareCreate("index1").setMapping(
|
||||||
"doc",
|
|
||||||
addFieldMappings(
|
addFieldMappings(
|
||||||
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent_type", "child_type"),
|
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent_type", "child_type"),
|
||||||
"nested_type",
|
"nested_type",
|
||||||
|
@ -662,8 +649,7 @@ public class InnerHitsIT extends ParentChildTestCase {
|
||||||
|
|
||||||
public void testTooHighResultWindow() {
|
public void testTooHighResultWindow() {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("index1").addMapping(
|
prepareCreate("index1").setMapping(
|
||||||
"doc",
|
|
||||||
addFieldMappings(
|
addFieldMappings(
|
||||||
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent_type", "child_type"),
|
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent_type", "child_type"),
|
||||||
"nested_type",
|
"nested_type",
|
||||||
|
|
|
@ -844,10 +844,8 @@ public class PercolatorQuerySearchIT extends OpenSearchIntegTestCase {
|
||||||
client().admin()
|
client().admin()
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate("test3")
|
.prepareCreate("test3")
|
||||||
.addMapping(
|
.setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field")
|
.startObject("field")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
|
@ -862,7 +860,6 @@ public class PercolatorQuerySearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -876,10 +873,8 @@ public class PercolatorQuerySearchIT extends OpenSearchIntegTestCase {
|
||||||
client().admin()
|
client().admin()
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate("test2")
|
.prepareCreate("test2")
|
||||||
.addMapping(
|
.setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field")
|
.startObject("field")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
|
@ -894,7 +889,6 @@ public class PercolatorQuerySearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -977,7 +971,7 @@ public class PercolatorQuerySearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(client().admin().indices().prepareCreate("test").addMapping("employee", mapping));
|
assertAcked(client().admin().indices().prepareCreate("test").setMapping(mapping));
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
.setId("q1")
|
.setId("q1")
|
||||||
.setSource(
|
.setSource(
|
||||||
|
|
|
@ -150,7 +150,7 @@ public class PercolatorQuerySearchTests extends OpenSearchSingleNodeTestCase {
|
||||||
.prepareCreate("test")
|
.prepareCreate("test")
|
||||||
// to avoid normal document from being cached by BitsetFilterCache
|
// to avoid normal document from being cached by BitsetFilterCache
|
||||||
.setSettings(Settings.builder().put(BitsetFilterCache.INDEX_LOAD_RANDOM_ACCESS_FILTERS_EAGERLY_SETTING.getKey(), false))
|
.setSettings(Settings.builder().put(BitsetFilterCache.INDEX_LOAD_RANDOM_ACCESS_FILTERS_EAGERLY_SETTING.getKey(), false))
|
||||||
.addMapping("employee", mapping)
|
.setMapping(mapping)
|
||||||
);
|
);
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
.setId("q1")
|
.setId("q1")
|
||||||
|
@ -238,7 +238,7 @@ public class PercolatorQuerySearchTests extends OpenSearchSingleNodeTestCase {
|
||||||
mapping.endObject();
|
mapping.endObject();
|
||||||
}
|
}
|
||||||
mapping.endObject();
|
mapping.endObject();
|
||||||
createIndex("test", client().admin().indices().prepareCreate("test").addMapping("employee", mapping));
|
createIndex("test", client().admin().indices().prepareCreate("test").setMapping(mapping));
|
||||||
Script script = new Script(ScriptType.INLINE, MockScriptPlugin.NAME, "use_fielddata_please", Collections.emptyMap());
|
Script script = new Script(ScriptType.INLINE, MockScriptPlugin.NAME, "use_fielddata_please", Collections.emptyMap());
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
.setId("q1")
|
.setId("q1")
|
||||||
|
|
|
@ -71,8 +71,6 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
*/
|
*/
|
||||||
public void testBasicUsage() throws Exception {
|
public void testBasicUsage() throws Exception {
|
||||||
String index = "foo";
|
String index = "foo";
|
||||||
String type = "mytype";
|
|
||||||
|
|
||||||
String[] equivalent = { "I WİLL USE TURKİSH CASING", "ı will use turkish casıng" };
|
String[] equivalent = { "I WİLL USE TURKİSH CASING", "ı will use turkish casıng" };
|
||||||
|
|
||||||
XContentBuilder builder = jsonBuilder().startObject()
|
XContentBuilder builder = jsonBuilder().startObject()
|
||||||
|
@ -88,7 +86,7 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
assertAcked(client().admin().indices().prepareCreate(index).addMapping(type, builder));
|
assertAcked(client().admin().indices().prepareCreate(index).setMapping(builder));
|
||||||
|
|
||||||
// both values should collate to same value
|
// both values should collate to same value
|
||||||
indexRandom(
|
indexRandom(
|
||||||
|
@ -114,7 +112,6 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testMultipleValues() throws Exception {
|
public void testMultipleValues() throws Exception {
|
||||||
String index = "foo";
|
String index = "foo";
|
||||||
String type = "mytype";
|
|
||||||
|
|
||||||
String[] equivalent = { "a", "C", "a", "B" };
|
String[] equivalent = { "a", "C", "a", "B" };
|
||||||
|
|
||||||
|
@ -130,7 +127,7 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
assertAcked(client().admin().indices().prepareCreate(index).addMapping(type, builder));
|
assertAcked(client().admin().indices().prepareCreate(index).setMapping(builder));
|
||||||
|
|
||||||
// everything should be indexed fine, no exceptions
|
// everything should be indexed fine, no exceptions
|
||||||
indexRandom(
|
indexRandom(
|
||||||
|
@ -177,7 +174,6 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
*/
|
*/
|
||||||
public void testNormalization() throws Exception {
|
public void testNormalization() throws Exception {
|
||||||
String index = "foo";
|
String index = "foo";
|
||||||
String type = "mytype";
|
|
||||||
|
|
||||||
String[] equivalent = { "I W\u0049\u0307LL USE TURKİSH CASING", "ı will use turkish casıng" };
|
String[] equivalent = { "I W\u0049\u0307LL USE TURKİSH CASING", "ı will use turkish casıng" };
|
||||||
|
|
||||||
|
@ -195,7 +191,7 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
assertAcked(client().admin().indices().prepareCreate(index).addMapping(type, builder));
|
assertAcked(client().admin().indices().prepareCreate(index).setMapping(builder));
|
||||||
|
|
||||||
indexRandom(
|
indexRandom(
|
||||||
true,
|
true,
|
||||||
|
@ -223,7 +219,6 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
*/
|
*/
|
||||||
public void testSecondaryStrength() throws Exception {
|
public void testSecondaryStrength() throws Exception {
|
||||||
String index = "foo";
|
String index = "foo";
|
||||||
String type = "mytype";
|
|
||||||
|
|
||||||
String[] equivalent = { "TESTING", "testing" };
|
String[] equivalent = { "TESTING", "testing" };
|
||||||
|
|
||||||
|
@ -241,7 +236,7 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
assertAcked(client().admin().indices().prepareCreate(index).addMapping(type, builder));
|
assertAcked(client().admin().indices().prepareCreate(index).setMapping(builder));
|
||||||
|
|
||||||
indexRandom(
|
indexRandom(
|
||||||
true,
|
true,
|
||||||
|
@ -269,7 +264,6 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
*/
|
*/
|
||||||
public void testIgnorePunctuation() throws Exception {
|
public void testIgnorePunctuation() throws Exception {
|
||||||
String index = "foo";
|
String index = "foo";
|
||||||
String type = "mytype";
|
|
||||||
|
|
||||||
String[] equivalent = { "foo-bar", "foo bar" };
|
String[] equivalent = { "foo-bar", "foo bar" };
|
||||||
|
|
||||||
|
@ -287,7 +281,7 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
assertAcked(client().admin().indices().prepareCreate(index).addMapping(type, builder));
|
assertAcked(client().admin().indices().prepareCreate(index).setMapping(builder));
|
||||||
|
|
||||||
indexRandom(
|
indexRandom(
|
||||||
true,
|
true,
|
||||||
|
@ -315,7 +309,6 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
*/
|
*/
|
||||||
public void testIgnoreWhitespace() throws Exception {
|
public void testIgnoreWhitespace() throws Exception {
|
||||||
String index = "foo";
|
String index = "foo";
|
||||||
String type = "mytype";
|
|
||||||
|
|
||||||
XContentBuilder builder = jsonBuilder().startObject()
|
XContentBuilder builder = jsonBuilder().startObject()
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
|
@ -333,7 +326,7 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
assertAcked(client().admin().indices().prepareCreate(index).addMapping(type, builder));
|
assertAcked(client().admin().indices().prepareCreate(index).setMapping(builder));
|
||||||
|
|
||||||
indexRandom(
|
indexRandom(
|
||||||
true,
|
true,
|
||||||
|
@ -363,7 +356,6 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
*/
|
*/
|
||||||
public void testNumerics() throws Exception {
|
public void testNumerics() throws Exception {
|
||||||
String index = "foo";
|
String index = "foo";
|
||||||
String type = "mytype";
|
|
||||||
|
|
||||||
XContentBuilder builder = jsonBuilder().startObject()
|
XContentBuilder builder = jsonBuilder().startObject()
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
|
@ -376,7 +368,7 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
assertAcked(client().admin().indices().prepareCreate(index).addMapping(type, builder));
|
assertAcked(client().admin().indices().prepareCreate(index).setMapping(builder));
|
||||||
|
|
||||||
indexRandom(
|
indexRandom(
|
||||||
true,
|
true,
|
||||||
|
@ -399,7 +391,6 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
*/
|
*/
|
||||||
public void testIgnoreAccentsButNotCase() throws Exception {
|
public void testIgnoreAccentsButNotCase() throws Exception {
|
||||||
String index = "foo";
|
String index = "foo";
|
||||||
String type = "mytype";
|
|
||||||
|
|
||||||
XContentBuilder builder = jsonBuilder().startObject()
|
XContentBuilder builder = jsonBuilder().startObject()
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
|
@ -416,7 +407,7 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
assertAcked(client().admin().indices().prepareCreate(index).addMapping(type, builder));
|
assertAcked(client().admin().indices().prepareCreate(index).setMapping(builder));
|
||||||
|
|
||||||
indexRandom(
|
indexRandom(
|
||||||
true,
|
true,
|
||||||
|
@ -441,7 +432,6 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
*/
|
*/
|
||||||
public void testUpperCaseFirst() throws Exception {
|
public void testUpperCaseFirst() throws Exception {
|
||||||
String index = "foo";
|
String index = "foo";
|
||||||
String type = "mytype";
|
|
||||||
|
|
||||||
XContentBuilder builder = jsonBuilder().startObject()
|
XContentBuilder builder = jsonBuilder().startObject()
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
|
@ -455,7 +445,7 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
assertAcked(client().admin().indices().prepareCreate(index).addMapping(type, builder));
|
assertAcked(client().admin().indices().prepareCreate(index).setMapping(builder));
|
||||||
|
|
||||||
indexRandom(
|
indexRandom(
|
||||||
true,
|
true,
|
||||||
|
@ -481,7 +471,6 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
*/
|
*/
|
||||||
public void testCustomRules() throws Exception {
|
public void testCustomRules() throws Exception {
|
||||||
String index = "foo";
|
String index = "foo";
|
||||||
String type = "mytype";
|
|
||||||
|
|
||||||
RuleBasedCollator baseCollator = (RuleBasedCollator) Collator.getInstance(new ULocale("de_DE"));
|
RuleBasedCollator baseCollator = (RuleBasedCollator) Collator.getInstance(new ULocale("de_DE"));
|
||||||
String DIN5007_2_tailorings = "& ae , a\u0308 & AE , A\u0308" + "& oe , o\u0308 & OE , O\u0308" + "& ue , u\u0308 & UE , u\u0308";
|
String DIN5007_2_tailorings = "& ae , a\u0308 & AE , A\u0308" + "& oe , o\u0308 & OE , O\u0308" + "& ue , u\u0308 & UE , u\u0308";
|
||||||
|
@ -504,7 +493,7 @@ public class ICUCollationKeywordFieldMapperIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
assertAcked(client().admin().indices().prepareCreate(index).addMapping(type, builder));
|
assertAcked(client().admin().indices().prepareCreate(index).setMapping(builder));
|
||||||
|
|
||||||
indexRandom(
|
indexRandom(
|
||||||
true,
|
true,
|
||||||
|
|
|
@ -63,10 +63,9 @@ public class SizeMappingIT extends OpenSearchIntegTestCase {
|
||||||
// issue 5053
|
// issue 5053
|
||||||
public void testThatUpdatingMappingShouldNotRemoveSizeMappingConfiguration() throws Exception {
|
public void testThatUpdatingMappingShouldNotRemoveSizeMappingConfiguration() throws Exception {
|
||||||
String index = "foo";
|
String index = "foo";
|
||||||
String type = MapperService.SINGLE_MAPPING_NAME;
|
|
||||||
|
|
||||||
XContentBuilder builder = jsonBuilder().startObject().startObject("_size").field("enabled", true).endObject().endObject();
|
XContentBuilder builder = jsonBuilder().startObject().startObject("_size").field("enabled", true).endObject().endObject();
|
||||||
assertAcked(client().admin().indices().prepareCreate(index).addMapping(type, builder));
|
assertAcked(client().admin().indices().prepareCreate(index).setMapping(builder));
|
||||||
|
|
||||||
// check mapping again
|
// check mapping again
|
||||||
assertSizeMappingEnabled(index, true);
|
assertSizeMappingEnabled(index, true);
|
||||||
|
@ -88,10 +87,9 @@ public class SizeMappingIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testThatSizeCanBeSwitchedOnAndOff() throws Exception {
|
public void testThatSizeCanBeSwitchedOnAndOff() throws Exception {
|
||||||
String index = "foo";
|
String index = "foo";
|
||||||
String type = MapperService.SINGLE_MAPPING_NAME;
|
|
||||||
|
|
||||||
XContentBuilder builder = jsonBuilder().startObject().startObject("_size").field("enabled", true).endObject().endObject();
|
XContentBuilder builder = jsonBuilder().startObject().startObject("_size").field("enabled", true).endObject().endObject();
|
||||||
assertAcked(client().admin().indices().prepareCreate(index).addMapping(type, builder));
|
assertAcked(client().admin().indices().prepareCreate(index).setMapping(builder));
|
||||||
|
|
||||||
// check mapping again
|
// check mapping again
|
||||||
assertSizeMappingEnabled(index, true);
|
assertSizeMappingEnabled(index, true);
|
||||||
|
|
|
@ -110,8 +110,7 @@ public class CreateIndexIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testNonNestedMappings() throws Exception {
|
public void testNonNestedMappings() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"_doc",
|
|
||||||
XContentFactory.jsonBuilder()
|
XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
|
@ -131,7 +130,7 @@ public class CreateIndexIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEmptyNestedMappings() throws Exception {
|
public void testEmptyNestedMappings() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("_doc", XContentFactory.jsonBuilder().startObject().endObject()));
|
assertAcked(prepareCreate("test").setMapping(XContentFactory.jsonBuilder().startObject().endObject()));
|
||||||
|
|
||||||
GetMappingsResponse response = client().admin().indices().prepareGetMappings("test").get();
|
GetMappingsResponse response = client().admin().indices().prepareGetMappings("test").get();
|
||||||
|
|
||||||
|
@ -144,10 +143,8 @@ public class CreateIndexIT extends OpenSearchIntegTestCase {
|
||||||
public void testMappingParamAndNestedMismatch() throws Exception {
|
public void testMappingParamAndNestedMismatch() throws Exception {
|
||||||
MapperParsingException e = expectThrows(
|
MapperParsingException e = expectThrows(
|
||||||
MapperParsingException.class,
|
MapperParsingException.class,
|
||||||
() -> prepareCreate("test").addMapping(
|
() -> prepareCreate("test").setMapping(XContentFactory.jsonBuilder().startObject().startObject("type2").endObject().endObject())
|
||||||
MapperService.SINGLE_MAPPING_NAME,
|
.get()
|
||||||
XContentFactory.jsonBuilder().startObject().startObject("type2").endObject().endObject()
|
|
||||||
).get()
|
|
||||||
);
|
);
|
||||||
assertThat(
|
assertThat(
|
||||||
e.getMessage(),
|
e.getMessage(),
|
||||||
|
@ -159,10 +156,7 @@ public class CreateIndexIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testEmptyMappings() throws Exception {
|
public void testEmptyMappings() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(XContentFactory.jsonBuilder().startObject().startObject("_doc").endObject().endObject())
|
||||||
"_doc",
|
|
||||||
XContentFactory.jsonBuilder().startObject().startObject("_doc").endObject().endObject()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
GetMappingsResponse response = client().admin().indices().prepareGetMappings("test").get();
|
GetMappingsResponse response = client().admin().indices().prepareGetMappings("test").get();
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test").addAlias(new Alias("alias")).addMapping("type1", mapping));
|
assertAcked(prepareCreate("test").addAlias(new Alias("alias")).setMapping(mapping));
|
||||||
|
|
||||||
client().prepareIndex("test").setId("667").setSource("field", "foo bar").execute().actionGet();
|
client().prepareIndex("test").setId("667").setSource("field", "foo bar").execute().actionGet();
|
||||||
refresh();
|
refresh();
|
||||||
|
@ -105,16 +105,14 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
||||||
|
|
||||||
public void testExistingFieldWithNoTermVectorsNoNPE() throws Exception {
|
public void testExistingFieldWithNoTermVectorsNoNPE() throws Exception {
|
||||||
XContentBuilder mapping = jsonBuilder().startObject()
|
XContentBuilder mapping = jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("existingfield")
|
.startObject("existingfield")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("term_vector", "with_positions_offsets_payloads")
|
.field("term_vector", "with_positions_offsets_payloads")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test").addAlias(new Alias("alias")).addMapping("type1", mapping));
|
assertAcked(prepareCreate("test").addAlias(new Alias("alias")).setMapping(mapping));
|
||||||
|
|
||||||
// when indexing a field that simply has a question mark, the term vectors will be null
|
// when indexing a field that simply has a question mark, the term vectors will be null
|
||||||
client().prepareIndex("test").setId("0").setSource("existingfield", "?").execute().actionGet();
|
client().prepareIndex("test").setId("0").setSource("existingfield", "?").execute().actionGet();
|
||||||
|
@ -133,16 +131,14 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
||||||
|
|
||||||
public void testExistingFieldButNotInDocNPE() throws Exception {
|
public void testExistingFieldButNotInDocNPE() throws Exception {
|
||||||
XContentBuilder mapping = jsonBuilder().startObject()
|
XContentBuilder mapping = jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("existingfield")
|
.startObject("existingfield")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("term_vector", "with_positions_offsets_payloads")
|
.field("term_vector", "with_positions_offsets_payloads")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test").addAlias(new Alias("alias")).addMapping("type1", mapping));
|
assertAcked(prepareCreate("test").addAlias(new Alias("alias")).setMapping(mapping));
|
||||||
|
|
||||||
// when indexing a field that simply has a question mark, the term vectors will be null
|
// when indexing a field that simply has a question mark, the term vectors will be null
|
||||||
client().prepareIndex("test").setId("0").setSource("anotherexistingfield", 1).execute().actionGet();
|
client().prepareIndex("test").setId("0").setSource("anotherexistingfield", 1).execute().actionGet();
|
||||||
|
@ -205,7 +201,6 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
||||||
|
|
||||||
public void testSimpleTermVectors() throws IOException {
|
public void testSimpleTermVectors() throws IOException {
|
||||||
XContentBuilder mapping = jsonBuilder().startObject()
|
XContentBuilder mapping = jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field")
|
.startObject("field")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -213,10 +208,9 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
||||||
.field("analyzer", "tv_test")
|
.field("analyzer", "tv_test")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping("type1", mapping)
|
prepareCreate("test").setMapping(mapping)
|
||||||
.addAlias(new Alias("alias"))
|
.addAlias(new Alias("alias"))
|
||||||
.setSettings(
|
.setSettings(
|
||||||
Settings.builder()
|
Settings.builder()
|
||||||
|
@ -316,7 +310,6 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
||||||
|
|
||||||
String optionString = termVectorOptionsToString(ft);
|
String optionString = termVectorOptionsToString(ft);
|
||||||
XContentBuilder mapping = jsonBuilder().startObject()
|
XContentBuilder mapping = jsonBuilder().startObject()
|
||||||
.startObject("_doc")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field")
|
.startObject("field")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -324,10 +317,9 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
||||||
.field("analyzer", "tv_test")
|
.field("analyzer", "tv_test")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping("_doc", mapping)
|
prepareCreate("test").setMapping(mapping)
|
||||||
.setSettings(
|
.setSettings(
|
||||||
Settings.builder()
|
Settings.builder()
|
||||||
.put("index.analysis.analyzer.tv_test.tokenizer", "standard")
|
.put("index.analysis.analyzer.tv_test.tokenizer", "standard")
|
||||||
|
@ -466,7 +458,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
||||||
fieldNames[i] = "field" + String.valueOf(i);
|
fieldNames[i] = "field" + String.valueOf(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
XContentBuilder mapping = jsonBuilder().startObject().startObject("type1").startObject("properties");
|
XContentBuilder mapping = jsonBuilder().startObject().startObject("properties");
|
||||||
XContentBuilder source = jsonBuilder().startObject();
|
XContentBuilder source = jsonBuilder().startObject();
|
||||||
for (String field : fieldNames) {
|
for (String field : fieldNames) {
|
||||||
mapping.startObject(field)
|
mapping.startObject(field)
|
||||||
|
@ -476,11 +468,11 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
||||||
.endObject();
|
.endObject();
|
||||||
source.field(field, "the quick brown fox jumps over the lazy dog");
|
source.field(field, "the quick brown fox jumps over the lazy dog");
|
||||||
}
|
}
|
||||||
mapping.endObject().endObject().endObject();
|
mapping.endObject().endObject();
|
||||||
source.endObject();
|
source.endObject();
|
||||||
|
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping("type1", mapping)
|
prepareCreate("test").setMapping(mapping)
|
||||||
.setSettings(
|
.setSettings(
|
||||||
Settings.builder()
|
Settings.builder()
|
||||||
.put(indexSettings())
|
.put(indexSettings())
|
||||||
|
@ -640,16 +632,16 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
||||||
public void testSimpleWildCards() throws IOException {
|
public void testSimpleWildCards() throws IOException {
|
||||||
int numFields = 25;
|
int numFields = 25;
|
||||||
|
|
||||||
XContentBuilder mapping = jsonBuilder().startObject().startObject("type1").startObject("properties");
|
XContentBuilder mapping = jsonBuilder().startObject().startObject("properties");
|
||||||
XContentBuilder source = jsonBuilder().startObject();
|
XContentBuilder source = jsonBuilder().startObject();
|
||||||
for (int i = 0; i < numFields; i++) {
|
for (int i = 0; i < numFields; i++) {
|
||||||
mapping.startObject("field" + i).field("type", "text").field("term_vector", randomBoolean() ? "yes" : "no").endObject();
|
mapping.startObject("field" + i).field("type", "text").field("term_vector", randomBoolean() ? "yes" : "no").endObject();
|
||||||
source.field("field" + i, "some text here");
|
source.field("field" + i, "some text here");
|
||||||
}
|
}
|
||||||
source.endObject();
|
source.endObject();
|
||||||
mapping.endObject().endObject().endObject();
|
mapping.endObject().endObject();
|
||||||
|
|
||||||
assertAcked(prepareCreate("test").addAlias(new Alias("alias")).addMapping("type1", mapping));
|
assertAcked(prepareCreate("test").addAlias(new Alias("alias")).setMapping(mapping));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test").setId("0").setSource(source).get();
|
client().prepareIndex("test").setId("0").setSource(source).get();
|
||||||
|
@ -744,7 +736,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
||||||
|
|
||||||
// setup mapping and document source
|
// setup mapping and document source
|
||||||
Set<String> withTermVectors = new HashSet<>();
|
Set<String> withTermVectors = new HashSet<>();
|
||||||
XContentBuilder mapping = jsonBuilder().startObject().startObject("type1").startObject("properties");
|
XContentBuilder mapping = jsonBuilder().startObject().startObject("properties");
|
||||||
XContentBuilder source = jsonBuilder().startObject();
|
XContentBuilder source = jsonBuilder().startObject();
|
||||||
for (int i = 0; i < numFields; i++) {
|
for (int i = 0; i < numFields; i++) {
|
||||||
String fieldName = "field" + i;
|
String fieldName = "field" + i;
|
||||||
|
@ -758,11 +750,11 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
||||||
source.field(fieldName, "some text here");
|
source.field(fieldName, "some text here");
|
||||||
}
|
}
|
||||||
source.endObject();
|
source.endObject();
|
||||||
mapping.endObject().endObject().endObject();
|
mapping.endObject().endObject();
|
||||||
|
|
||||||
// setup indices with mapping
|
// setup indices with mapping
|
||||||
Settings.Builder settings = Settings.builder().put(indexSettings()).put("index.analysis.analyzer", "standard");
|
Settings.Builder settings = Settings.builder().put(indexSettings()).put("index.analysis.analyzer", "standard");
|
||||||
assertAcked(prepareCreate("test").addAlias(new Alias("alias")).setSettings(settings).addMapping("type1", mapping));
|
assertAcked(prepareCreate("test").addAlias(new Alias("alias")).setSettings(settings).setMapping(mapping));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
// index a single document with prepared source
|
// index a single document with prepared source
|
||||||
|
|
|
@ -261,7 +261,7 @@ public class SimpleClusterStateIT extends OpenSearchIntegTestCase {
|
||||||
ByteSizeValue.parseBytesSizeValue("10k", "estimatedBytesSize").bytesAsInt(),
|
ByteSizeValue.parseBytesSizeValue("10k", "estimatedBytesSize").bytesAsInt(),
|
||||||
ByteSizeValue.parseBytesSizeValue("256k", "estimatedBytesSize").bytesAsInt()
|
ByteSizeValue.parseBytesSizeValue("256k", "estimatedBytesSize").bytesAsInt()
|
||||||
);
|
);
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder().startObject().startObject("type").startObject("properties");
|
XContentBuilder mapping = XContentFactory.jsonBuilder().startObject().startObject("properties");
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
int numberOfFields = 0;
|
int numberOfFields = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -273,7 +273,7 @@ public class SimpleClusterStateIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.info("number of fields [{}], estimated bytes [{}]", numberOfFields, estimatedBytesSize);
|
logger.info("number of fields [{}], estimated bytes [{}]", numberOfFields, estimatedBytesSize);
|
||||||
mapping.endObject().endObject().endObject();
|
mapping.endObject().endObject();
|
||||||
|
|
||||||
int numberOfShards = scaledRandomIntBetween(1, cluster().numDataNodes());
|
int numberOfShards = scaledRandomIntBetween(1, cluster().numDataNodes());
|
||||||
// if the create index is ack'ed, then all nodes have successfully processed the cluster state
|
// if the create index is ack'ed, then all nodes have successfully processed the cluster state
|
||||||
|
@ -287,7 +287,7 @@ public class SimpleClusterStateIT extends OpenSearchIntegTestCase {
|
||||||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||||
.put(MapperService.INDEX_MAPPING_TOTAL_FIELDS_LIMIT_SETTING.getKey(), Long.MAX_VALUE)
|
.put(MapperService.INDEX_MAPPING_TOTAL_FIELDS_LIMIT_SETTING.getKey(), Long.MAX_VALUE)
|
||||||
)
|
)
|
||||||
.addMapping("type", mapping)
|
.setMapping(mapping)
|
||||||
.setTimeout("60s")
|
.setTimeout("60s")
|
||||||
.get()
|
.get()
|
||||||
);
|
);
|
||||||
|
|
|
@ -105,10 +105,7 @@ public class GatewayIndexStateIT extends OpenSearchIntegTestCase {
|
||||||
client().admin()
|
client().admin()
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate("test")
|
.prepareCreate("test")
|
||||||
.addMapping(
|
.setMapping(XContentFactory.jsonBuilder().startObject().startObject("_routing").field("required", true).endObject().endObject())
|
||||||
"type1",
|
|
||||||
XContentFactory.jsonBuilder().startObject().startObject("_routing").field("required", true).endObject().endObject()
|
|
||||||
)
|
|
||||||
.execute()
|
.execute()
|
||||||
.actionGet();
|
.actionGet();
|
||||||
|
|
||||||
|
|
|
@ -541,10 +541,8 @@ public class GetActionIT extends OpenSearchIntegTestCase {
|
||||||
public void testGetFieldsNonLeafField() throws Exception {
|
public void testGetFieldsNonLeafField() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addAlias(new Alias("alias"))
|
prepareCreate("test").addAlias(new Alias("alias"))
|
||||||
.addMapping(
|
.setMapping(
|
||||||
"my-type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("my-type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
|
@ -555,7 +553,6 @@ public class GetActionIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
.setSettings(Settings.builder().put("index.refresh_interval", -1))
|
.setSettings(Settings.builder().put("index.refresh_interval", -1))
|
||||||
);
|
);
|
||||||
|
@ -582,10 +579,8 @@ public class GetActionIT extends OpenSearchIntegTestCase {
|
||||||
prepareCreate("my-index")
|
prepareCreate("my-index")
|
||||||
// multi types in 5.6
|
// multi types in 5.6
|
||||||
.setSettings(Settings.builder().put("index.refresh_interval", -1))
|
.setSettings(Settings.builder().put("index.refresh_interval", -1))
|
||||||
.addMapping(
|
.setMapping(
|
||||||
"my-type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("my-type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "object")
|
.field("type", "object")
|
||||||
|
@ -608,7 +603,6 @@ public class GetActionIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class IndexSortIT extends OpenSearchIntegTestCase {
|
||||||
.put("index.number_of_shards", "1")
|
.put("index.number_of_shards", "1")
|
||||||
.put("index.number_of_replicas", "1")
|
.put("index.number_of_replicas", "1")
|
||||||
.putList("index.sort.field", "date", "numeric_dv", "keyword_dv")
|
.putList("index.sort.field", "date", "numeric_dv", "keyword_dv")
|
||||||
).addMapping("test", TEST_MAPPING).get();
|
).setMapping(TEST_MAPPING).get();
|
||||||
for (int i = 0; i < 20; i++) {
|
for (int i = 0; i < 20; i++) {
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
.setId(Integer.toString(i))
|
.setId(Integer.toString(i))
|
||||||
|
@ -108,7 +108,7 @@ public class IndexSortIT extends OpenSearchIntegTestCase {
|
||||||
IllegalArgumentException exc = expectThrows(
|
IllegalArgumentException exc = expectThrows(
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
() -> prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).putList("index.sort.field", "invalid_field"))
|
() -> prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).putList("index.sort.field", "invalid_field"))
|
||||||
.addMapping("test", TEST_MAPPING)
|
.setMapping(TEST_MAPPING)
|
||||||
.get()
|
.get()
|
||||||
);
|
);
|
||||||
assertThat(exc.getMessage(), containsString("unknown index sort field:[invalid_field]"));
|
assertThat(exc.getMessage(), containsString("unknown index sort field:[invalid_field]"));
|
||||||
|
@ -116,7 +116,7 @@ public class IndexSortIT extends OpenSearchIntegTestCase {
|
||||||
exc = expectThrows(
|
exc = expectThrows(
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
() -> prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).putList("index.sort.field", "numeric"))
|
() -> prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).putList("index.sort.field", "numeric"))
|
||||||
.addMapping("test", TEST_MAPPING)
|
.setMapping(TEST_MAPPING)
|
||||||
.get()
|
.get()
|
||||||
);
|
);
|
||||||
assertThat(exc.getMessage(), containsString("docvalues not found for index sort field:[numeric]"));
|
assertThat(exc.getMessage(), containsString("docvalues not found for index sort field:[numeric]"));
|
||||||
|
@ -124,7 +124,7 @@ public class IndexSortIT extends OpenSearchIntegTestCase {
|
||||||
exc = expectThrows(
|
exc = expectThrows(
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
() -> prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).putList("index.sort.field", "keyword"))
|
() -> prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).putList("index.sort.field", "keyword"))
|
||||||
.addMapping("test", TEST_MAPPING)
|
.setMapping(TEST_MAPPING)
|
||||||
.get()
|
.get()
|
||||||
);
|
);
|
||||||
assertThat(exc.getMessage(), containsString("docvalues not found for index sort field:[keyword]"));
|
assertThat(exc.getMessage(), containsString("docvalues not found for index sort field:[keyword]"));
|
||||||
|
|
|
@ -43,10 +43,8 @@ public class FieldDataLoadingIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testEagerGlobalOrdinalsFieldDataLoading() throws Exception {
|
public void testEagerGlobalOrdinalsFieldDataLoading() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("name")
|
.startObject("name")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -55,7 +53,6 @@ public class FieldDataLoadingIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
|
@ -50,7 +50,7 @@ import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
public class CopyToMapperIntegrationIT extends OpenSearchIntegTestCase {
|
public class CopyToMapperIntegrationIT extends OpenSearchIntegTestCase {
|
||||||
public void testDynamicTemplateCopyTo() throws Exception {
|
public void testDynamicTemplateCopyTo() throws Exception {
|
||||||
assertAcked(client().admin().indices().prepareCreate("test-idx").addMapping("_doc", createDynamicTemplateMapping()));
|
assertAcked(client().admin().indices().prepareCreate("test-idx").setMapping(createDynamicTemplateMapping()));
|
||||||
|
|
||||||
int recordCount = between(1, 200);
|
int recordCount = between(1, 200);
|
||||||
|
|
||||||
|
@ -98,7 +98,6 @@ public class CopyToMapperIntegrationIT extends OpenSearchIntegTestCase {
|
||||||
private XContentBuilder createDynamicTemplateMapping() throws IOException {
|
private XContentBuilder createDynamicTemplateMapping() throws IOException {
|
||||||
return XContentFactory.jsonBuilder()
|
return XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("_doc")
|
|
||||||
.startArray("dynamic_templates")
|
.startArray("dynamic_templates")
|
||||||
|
|
||||||
.startObject()
|
.startObject()
|
||||||
|
@ -124,7 +123,6 @@ public class CopyToMapperIntegrationIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
|
|
||||||
.endArray()
|
.endArray()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,18 +55,15 @@ public class ExternalValuesMapperIntegrationIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHighlightingOnCustomString() throws Exception {
|
public void testHighlightingOnCustomString() throws Exception {
|
||||||
prepareCreate("test-idx").addMapping(
|
prepareCreate("test-idx").setMapping(
|
||||||
"type",
|
|
||||||
XContentFactory.jsonBuilder()
|
XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field")
|
.startObject("field")
|
||||||
.field("type", FakeStringFieldMapper.CONTENT_TYPE)
|
.field("type", FakeStringFieldMapper.CONTENT_TYPE)
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
).execute().get();
|
).execute().get();
|
||||||
|
|
||||||
index(
|
index(
|
||||||
|
@ -118,11 +115,9 @@ public class ExternalValuesMapperIntegrationIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExternalValues() throws Exception {
|
public void testExternalValues() throws Exception {
|
||||||
prepareCreate("test-idx").addMapping(
|
prepareCreate("test-idx").setMapping(
|
||||||
"type",
|
|
||||||
XContentFactory.jsonBuilder()
|
XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject(ExternalMetadataMapper.CONTENT_TYPE)
|
.startObject(ExternalMetadataMapper.CONTENT_TYPE)
|
||||||
.endObject()
|
.endObject()
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
|
@ -131,7 +126,6 @@ public class ExternalValuesMapperIntegrationIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
).execute().get();
|
).execute().get();
|
||||||
|
|
||||||
index("test-idx", "type", "1", XContentFactory.jsonBuilder().startObject().field("field", "1234").endObject());
|
index("test-idx", "type", "1", XContentFactory.jsonBuilder().startObject().field("field", "1234").endObject());
|
||||||
|
@ -166,11 +160,9 @@ public class ExternalValuesMapperIntegrationIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExternalValuesWithMultifield() throws Exception {
|
public void testExternalValuesWithMultifield() throws Exception {
|
||||||
prepareCreate("test-idx").addMapping(
|
prepareCreate("test-idx").setMapping(
|
||||||
"_doc",
|
|
||||||
XContentFactory.jsonBuilder()
|
XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("_doc")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("f")
|
.startObject("f")
|
||||||
.field("type", ExternalMapperPlugin.EXTERNAL_UPPER)
|
.field("type", ExternalMapperPlugin.EXTERNAL_UPPER)
|
||||||
|
@ -189,7 +181,6 @@ public class ExternalValuesMapperIntegrationIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
).execute().get();
|
).execute().get();
|
||||||
|
|
||||||
index("test-idx", "_doc", "1", "f", "This is my text");
|
index("test-idx", "_doc", "1", "f", "This is my text");
|
||||||
|
|
|
@ -58,7 +58,7 @@ import static org.hamcrest.Matchers.nullValue;
|
||||||
public class MultiFieldsIntegrationIT extends OpenSearchIntegTestCase {
|
public class MultiFieldsIntegrationIT extends OpenSearchIntegTestCase {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testMultiFields() throws Exception {
|
public void testMultiFields() throws Exception {
|
||||||
assertAcked(client().admin().indices().prepareCreate("my-index").addMapping("my-type", createTypeSource()));
|
assertAcked(client().admin().indices().prepareCreate("my-index").setMapping(createTypeSource()));
|
||||||
|
|
||||||
GetMappingsResponse getMappingsResponse = client().admin().indices().prepareGetMappings("my-index").get();
|
GetMappingsResponse getMappingsResponse = client().admin().indices().prepareGetMappings("my-index").get();
|
||||||
MappingMetadata mappingMetadata = getMappingsResponse.mappings().get("my-index");
|
MappingMetadata mappingMetadata = getMappingsResponse.mappings().get("my-index");
|
||||||
|
@ -98,7 +98,7 @@ public class MultiFieldsIntegrationIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testGeoPointMultiField() throws Exception {
|
public void testGeoPointMultiField() throws Exception {
|
||||||
assertAcked(client().admin().indices().prepareCreate("my-index").addMapping("my-type", createMappingSource("geo_point")));
|
assertAcked(client().admin().indices().prepareCreate("my-index").setMapping(createMappingSource("geo_point")));
|
||||||
|
|
||||||
GetMappingsResponse getMappingsResponse = client().admin().indices().prepareGetMappings("my-index").get();
|
GetMappingsResponse getMappingsResponse = client().admin().indices().prepareGetMappings("my-index").get();
|
||||||
MappingMetadata mappingMetadata = getMappingsResponse.mappings().get("my-index");
|
MappingMetadata mappingMetadata = getMappingsResponse.mappings().get("my-index");
|
||||||
|
@ -127,7 +127,7 @@ public class MultiFieldsIntegrationIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testCompletionMultiField() throws Exception {
|
public void testCompletionMultiField() throws Exception {
|
||||||
assertAcked(client().admin().indices().prepareCreate("my-index").addMapping("my-type", createMappingSource("completion")));
|
assertAcked(client().admin().indices().prepareCreate("my-index").setMapping(createMappingSource("completion")));
|
||||||
|
|
||||||
GetMappingsResponse getMappingsResponse = client().admin().indices().prepareGetMappings("my-index").get();
|
GetMappingsResponse getMappingsResponse = client().admin().indices().prepareGetMappings("my-index").get();
|
||||||
MappingMetadata mappingMetadata = getMappingsResponse.mappings().get("my-index");
|
MappingMetadata mappingMetadata = getMappingsResponse.mappings().get("my-index");
|
||||||
|
@ -149,7 +149,7 @@ public class MultiFieldsIntegrationIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testIpMultiField() throws Exception {
|
public void testIpMultiField() throws Exception {
|
||||||
assertAcked(client().admin().indices().prepareCreate("my-index").addMapping("my-type", createMappingSource("ip")));
|
assertAcked(client().admin().indices().prepareCreate("my-index").setMapping(createMappingSource("ip")));
|
||||||
|
|
||||||
GetMappingsResponse getMappingsResponse = client().admin().indices().prepareGetMappings("my-index").get();
|
GetMappingsResponse getMappingsResponse = client().admin().indices().prepareGetMappings("my-index").get();
|
||||||
MappingMetadata mappingMetadata = getMappingsResponse.mappings().get("my-index");
|
MappingMetadata mappingMetadata = getMappingsResponse.mappings().get("my-index");
|
||||||
|
@ -172,7 +172,6 @@ public class MultiFieldsIntegrationIT extends OpenSearchIntegTestCase {
|
||||||
private XContentBuilder createMappingSource(String fieldType) throws IOException {
|
private XContentBuilder createMappingSource(String fieldType) throws IOException {
|
||||||
return XContentFactory.jsonBuilder()
|
return XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("my-type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("a")
|
.startObject("a")
|
||||||
.field("type", fieldType)
|
.field("type", fieldType)
|
||||||
|
@ -183,14 +182,12 @@ public class MultiFieldsIntegrationIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
private XContentBuilder createTypeSource() throws IOException {
|
private XContentBuilder createTypeSource() throws IOException {
|
||||||
return XContentFactory.jsonBuilder()
|
return XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("my-type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("title")
|
.startObject("title")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -201,7 +198,6 @@ public class MultiFieldsIntegrationIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,18 +78,16 @@ public class PreBuiltAnalyzerIntegrationIT extends OpenSearchIntegTestCase {
|
||||||
loadedAnalyzers.get(preBuiltAnalyzer).add(randomVersion);
|
loadedAnalyzers.get(preBuiltAnalyzer).add(randomVersion);
|
||||||
|
|
||||||
final XContentBuilder mapping = jsonBuilder().startObject()
|
final XContentBuilder mapping = jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("foo")
|
.startObject("foo")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("analyzer", name)
|
.field("analyzer", name)
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
Settings versionSettings = settings(randomVersion).build();
|
Settings versionSettings = settings(randomVersion).build();
|
||||||
client().admin().indices().prepareCreate(indexName).addMapping("type", mapping).setSettings(versionSettings).get();
|
client().admin().indices().prepareCreate(indexName).setMapping(mapping).setSettings(versionSettings).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
|
@ -80,9 +80,8 @@ public class SimpleGetFieldMappingsIT extends OpenSearchIntegTestCase {
|
||||||
assertThat(response.fieldMappings("index", "field"), nullValue());
|
assertThat(response.fieldMappings("index", "field"), nullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private XContentBuilder getMappingForType(String type) throws IOException {
|
private XContentBuilder getMappingForType() throws IOException {
|
||||||
return jsonBuilder().startObject()
|
return jsonBuilder().startObject()
|
||||||
.startObject(type)
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -99,14 +98,13 @@ public class SimpleGetFieldMappingsIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetFieldMappings() throws Exception {
|
public void testGetFieldMappings() throws Exception {
|
||||||
|
|
||||||
assertAcked(prepareCreate("indexa").addMapping("typeA", getMappingForType("typeA")));
|
assertAcked(prepareCreate("indexa").setMapping(getMappingForType()));
|
||||||
assertAcked(client().admin().indices().prepareCreate("indexb").addMapping("typeB", getMappingForType("typeB")));
|
assertAcked(client().admin().indices().prepareCreate("indexb").setMapping(getMappingForType()));
|
||||||
|
|
||||||
// Get mappings by full name
|
// Get mappings by full name
|
||||||
GetFieldMappingsResponse response = client().admin()
|
GetFieldMappingsResponse response = client().admin()
|
||||||
|
@ -136,7 +134,7 @@ public class SimpleGetFieldMappingsIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testSimpleGetFieldMappingsWithDefaults() throws Exception {
|
public void testSimpleGetFieldMappingsWithDefaults() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type", getMappingForType("type")));
|
assertAcked(prepareCreate("test").setMapping(getMappingForType()));
|
||||||
client().admin().indices().preparePutMapping("test").setSource("num", "type=long").get();
|
client().admin().indices().preparePutMapping("test").setSource("num", "type=long").get();
|
||||||
client().admin().indices().preparePutMapping("test").setSource("field2", "type=text,index=false").get();
|
client().admin().indices().preparePutMapping("test").setSource("field2", "type=text,index=false").get();
|
||||||
|
|
||||||
|
@ -163,7 +161,7 @@ public class SimpleGetFieldMappingsIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testGetFieldMappingsWithFieldAlias() throws Exception {
|
public void testGetFieldMappingsWithFieldAlias() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type", getMappingForType("type")));
|
assertAcked(prepareCreate("test").setMapping(getMappingForType()));
|
||||||
|
|
||||||
GetFieldMappingsResponse response = client().admin().indices().prepareGetFieldMappings().setFields("alias", "field1").get();
|
GetFieldMappingsResponse response = client().admin().indices().prepareGetFieldMappings().setFields("alias", "field1").get();
|
||||||
|
|
||||||
|
@ -179,7 +177,7 @@ public class SimpleGetFieldMappingsIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
// fix #6552
|
// fix #6552
|
||||||
public void testSimpleGetFieldMappingsWithPretty() throws Exception {
|
public void testSimpleGetFieldMappingsWithPretty() throws Exception {
|
||||||
assertAcked(prepareCreate("index").addMapping("type", getMappingForType("type")));
|
assertAcked(prepareCreate("index").setMapping(getMappingForType()));
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>();
|
||||||
params.put("pretty", "true");
|
params.put("pretty", "true");
|
||||||
GetFieldMappingsResponse response = client().admin()
|
GetFieldMappingsResponse response = client().admin()
|
||||||
|
@ -209,7 +207,7 @@ public class SimpleGetFieldMappingsIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetFieldMappingsWithBlocks() throws Exception {
|
public void testGetFieldMappingsWithBlocks() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("_doc", getMappingForType("_doc")));
|
assertAcked(prepareCreate("test").setMapping(getMappingForType()));
|
||||||
|
|
||||||
for (String block : Arrays.asList(SETTING_BLOCKS_READ, SETTING_BLOCKS_WRITE, SETTING_READ_ONLY)) {
|
for (String block : Arrays.asList(SETTING_BLOCKS_READ, SETTING_BLOCKS_WRITE, SETTING_READ_ONLY)) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -70,21 +70,19 @@ public class SimpleGetMappingsIT extends OpenSearchIntegTestCase {
|
||||||
assertEquals(MappingMetadata.EMPTY_MAPPINGS, response.mappings().get("index"));
|
assertEquals(MappingMetadata.EMPTY_MAPPINGS, response.mappings().get("index"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private XContentBuilder getMappingForType(String type) throws IOException {
|
private XContentBuilder getMappingForType() throws IOException {
|
||||||
return jsonBuilder().startObject()
|
return jsonBuilder().startObject()
|
||||||
.startObject(type)
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSimpleGetMappings() throws Exception {
|
public void testSimpleGetMappings() throws Exception {
|
||||||
client().admin().indices().prepareCreate("indexa").addMapping("typeA", getMappingForType("typeA")).execute().actionGet();
|
client().admin().indices().prepareCreate("indexa").setMapping(getMappingForType()).execute().actionGet();
|
||||||
client().admin().indices().prepareCreate("indexb").addMapping("typeA", getMappingForType("typeA")).execute().actionGet();
|
client().admin().indices().prepareCreate("indexb").setMapping(getMappingForType()).execute().actionGet();
|
||||||
|
|
||||||
ClusterHealthResponse clusterHealth = client().admin()
|
ClusterHealthResponse clusterHealth = client().admin()
|
||||||
.cluster()
|
.cluster()
|
||||||
|
@ -114,7 +112,7 @@ public class SimpleGetMappingsIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetMappingsWithBlocks() throws IOException {
|
public void testGetMappingsWithBlocks() throws IOException {
|
||||||
client().admin().indices().prepareCreate("test").addMapping("_doc", getMappingForType("_doc")).execute().actionGet();
|
client().admin().indices().prepareCreate("test").setMapping(getMappingForType()).execute().actionGet();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
for (String block : Arrays.asList(SETTING_BLOCKS_READ, SETTING_BLOCKS_WRITE, SETTING_READ_ONLY)) {
|
for (String block : Arrays.asList(SETTING_BLOCKS_READ, SETTING_BLOCKS_WRITE, SETTING_READ_ONLY)) {
|
||||||
|
|
|
@ -129,16 +129,7 @@ public class SimpleMgetIT extends OpenSearchIntegTestCase {
|
||||||
public void testThatMgetShouldWorkWithAliasRouting() throws IOException {
|
public void testThatMgetShouldWorkWithAliasRouting() throws IOException {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addAlias(new Alias("alias1").routing("abc"))
|
prepareCreate("test").addAlias(new Alias("alias1").routing("abc"))
|
||||||
.addMapping(
|
.setMapping(jsonBuilder().startObject().startObject("_routing").field("required", true).endObject().endObject())
|
||||||
"test",
|
|
||||||
jsonBuilder().startObject()
|
|
||||||
.startObject("test")
|
|
||||||
.startObject("_routing")
|
|
||||||
.field("required", true)
|
|
||||||
.endObject()
|
|
||||||
.endObject()
|
|
||||||
.endObject()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
client().prepareIndex("alias1")
|
client().prepareIndex("alias1")
|
||||||
|
|
|
@ -351,17 +351,7 @@ public class SimpleRoutingIT extends OpenSearchIntegTestCase {
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate("test")
|
.prepareCreate("test")
|
||||||
.addAlias(new Alias("alias"))
|
.addAlias(new Alias("alias"))
|
||||||
.addMapping(
|
.setMapping(XContentFactory.jsonBuilder().startObject().startObject("_routing").field("required", true).endObject().endObject())
|
||||||
"type1",
|
|
||||||
XContentFactory.jsonBuilder()
|
|
||||||
.startObject()
|
|
||||||
.startObject("type1")
|
|
||||||
.startObject("_routing")
|
|
||||||
.field("required", true)
|
|
||||||
.endObject()
|
|
||||||
.endObject()
|
|
||||||
.endObject()
|
|
||||||
)
|
|
||||||
.execute()
|
.execute()
|
||||||
.actionGet();
|
.actionGet();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -450,17 +440,7 @@ public class SimpleRoutingIT extends OpenSearchIntegTestCase {
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate("test")
|
.prepareCreate("test")
|
||||||
.addAlias(new Alias("alias"))
|
.addAlias(new Alias("alias"))
|
||||||
.addMapping(
|
.setMapping(XContentFactory.jsonBuilder().startObject().startObject("_routing").field("required", true).endObject().endObject())
|
||||||
"type1",
|
|
||||||
XContentFactory.jsonBuilder()
|
|
||||||
.startObject()
|
|
||||||
.startObject("type1")
|
|
||||||
.startObject("_routing")
|
|
||||||
.field("required", true)
|
|
||||||
.endObject()
|
|
||||||
.endObject()
|
|
||||||
.endObject()
|
|
||||||
)
|
|
||||||
.execute()
|
.execute()
|
||||||
.actionGet();
|
.actionGet();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -544,17 +524,7 @@ public class SimpleRoutingIT extends OpenSearchIntegTestCase {
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate("test")
|
.prepareCreate("test")
|
||||||
.addAlias(new Alias("alias"))
|
.addAlias(new Alias("alias"))
|
||||||
.addMapping(
|
.setMapping(XContentFactory.jsonBuilder().startObject().startObject("_routing").field("required", true).endObject().endObject())
|
||||||
"type1",
|
|
||||||
XContentFactory.jsonBuilder()
|
|
||||||
.startObject()
|
|
||||||
.startObject("type1")
|
|
||||||
.startObject("_routing")
|
|
||||||
.field("required", true)
|
|
||||||
.endObject()
|
|
||||||
.endObject()
|
|
||||||
.endObject()
|
|
||||||
)
|
|
||||||
.execute()
|
.execute()
|
||||||
.actionGet();
|
.actionGet();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
|
@ -115,10 +115,8 @@ public class CombiIT extends OpenSearchIntegTestCase {
|
||||||
*/
|
*/
|
||||||
public void testSubAggregationForTopAggregationOnUnmappedField() throws Exception {
|
public void testSubAggregationForTopAggregationOnUnmappedField() throws Exception {
|
||||||
|
|
||||||
prepareCreate("idx").addMapping(
|
prepareCreate("idx").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("name")
|
.startObject("name")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
|
@ -128,7 +126,6 @@ public class CombiIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
).get();
|
).get();
|
||||||
|
|
||||||
ensureSearchable("idx");
|
ensureSearchable("idx");
|
||||||
|
|
|
@ -133,17 +133,14 @@ public class EquivalenceIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareCreate("idx").addMapping(
|
prepareCreate("idx").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("values")
|
.startObject("values")
|
||||||
.field("type", "double")
|
.field("type", "double")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
).get();
|
).get();
|
||||||
|
|
||||||
for (int i = 0; i < docs.length; ++i) {
|
for (int i = 0; i < docs.length; ++i) {
|
||||||
|
@ -235,10 +232,8 @@ public class EquivalenceIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
final IntHashSet valuesSet = new IntHashSet();
|
final IntHashSet valuesSet = new IntHashSet();
|
||||||
cluster().wipeIndices("idx");
|
cluster().wipeIndices("idx");
|
||||||
prepareCreate("idx").addMapping(
|
prepareCreate("idx").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("num")
|
.startObject("num")
|
||||||
.field("type", "double")
|
.field("type", "double")
|
||||||
|
@ -260,7 +255,6 @@ public class EquivalenceIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
).get();
|
).get();
|
||||||
|
|
||||||
List<IndexRequestBuilder> indexingRequests = new ArrayList<>();
|
List<IndexRequestBuilder> indexingRequests = new ArrayList<>();
|
||||||
|
@ -358,17 +352,14 @@ public class EquivalenceIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
// Duel between histograms and scripted terms
|
// Duel between histograms and scripted terms
|
||||||
public void testDuelTermsHistogram() throws Exception {
|
public void testDuelTermsHistogram() throws Exception {
|
||||||
prepareCreate("idx").addMapping(
|
prepareCreate("idx").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("num")
|
.startObject("num")
|
||||||
.field("type", "double")
|
.field("type", "double")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
).get();
|
).get();
|
||||||
|
|
||||||
final int numDocs = scaledRandomIntBetween(500, 5000);
|
final int numDocs = scaledRandomIntBetween(500, 5000);
|
||||||
|
@ -422,17 +413,14 @@ public class EquivalenceIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testLargeNumbersOfPercentileBuckets() throws Exception {
|
public void testLargeNumbersOfPercentileBuckets() throws Exception {
|
||||||
// test high numbers of percentile buckets to make sure paging and release work correctly
|
// test high numbers of percentile buckets to make sure paging and release work correctly
|
||||||
prepareCreate("idx").addMapping(
|
prepareCreate("idx").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("double_value")
|
.startObject("double_value")
|
||||||
.field("type", "double")
|
.field("type", "double")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
).get();
|
).get();
|
||||||
|
|
||||||
final int numDocs = scaledRandomIntBetween(2500, 5000);
|
final int numDocs = scaledRandomIntBetween(2500, 5000);
|
||||||
|
|
|
@ -158,10 +158,8 @@ public class NestedIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("idx_nested_nested_aggs").addMapping(
|
prepareCreate("idx_nested_nested_aggs").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("nested1")
|
.startObject("nested1")
|
||||||
.field("type", "nested")
|
.field("type", "nested")
|
||||||
|
@ -173,7 +171,6 @@ public class NestedIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen("idx_nested_nested_aggs");
|
ensureGreen("idx_nested_nested_aggs");
|
||||||
|
@ -400,7 +397,6 @@ public class NestedIT extends OpenSearchIntegTestCase {
|
||||||
// Test based on: https://github.com/elastic/elasticsearch/issues/9280
|
// Test based on: https://github.com/elastic/elasticsearch/issues/9280
|
||||||
public void testParentFilterResolvedCorrectly() throws Exception {
|
public void testParentFilterResolvedCorrectly() throws Exception {
|
||||||
XContentBuilder mapping = jsonBuilder().startObject()
|
XContentBuilder mapping = jsonBuilder().startObject()
|
||||||
.startObject("provider")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("comments")
|
.startObject("comments")
|
||||||
.field("type", "nested")
|
.field("type", "nested")
|
||||||
|
@ -450,11 +446,10 @@ public class NestedIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("idx2").setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0))
|
prepareCreate("idx2").setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0))
|
||||||
.addMapping("provider", mapping)
|
.setMapping(mapping)
|
||||||
);
|
);
|
||||||
ensureGreen("idx2");
|
ensureGreen("idx2");
|
||||||
|
|
||||||
|
@ -649,10 +644,8 @@ public class NestedIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testFilterAggInsideNestedAgg() throws Exception {
|
public void testFilterAggInsideNestedAgg() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("classes").addMapping(
|
prepareCreate("classes").setMapping(
|
||||||
"class",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("class")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("name")
|
.startObject("name")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -681,7 +674,6 @@ public class NestedIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,7 @@ public class ReverseNestedIT extends OpenSearchIntegTestCase {
|
||||||
@Override
|
@Override
|
||||||
public void setupSuiteScopeCluster() throws Exception {
|
public void setupSuiteScopeCluster() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("idx1").addMapping(
|
prepareCreate("idx1").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
|
@ -99,8 +98,7 @@ public class ReverseNestedIT extends OpenSearchIntegTestCase {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("idx2").addMapping(
|
prepareCreate("idx2").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("nested1")
|
.startObject("nested1")
|
||||||
|
@ -531,7 +529,6 @@ public class ReverseNestedIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testSameParentDocHavingMultipleBuckets() throws Exception {
|
public void testSameParentDocHavingMultipleBuckets() throws Exception {
|
||||||
XContentBuilder mapping = jsonBuilder().startObject()
|
XContentBuilder mapping = jsonBuilder().startObject()
|
||||||
.startObject("product")
|
|
||||||
.field("dynamic", "strict")
|
.field("dynamic", "strict")
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("id")
|
.startObject("id")
|
||||||
|
@ -562,11 +559,10 @@ public class ReverseNestedIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("idx3").setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0))
|
prepareCreate("idx3").setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0))
|
||||||
.addMapping("product", mapping)
|
.setMapping(mapping)
|
||||||
);
|
);
|
||||||
|
|
||||||
client().prepareIndex("idx3")
|
client().prepareIndex("idx3")
|
||||||
|
|
|
@ -128,10 +128,8 @@ public class CardinalityIT extends OpenSearchIntegTestCase {
|
||||||
@Override
|
@Override
|
||||||
public void setupSuiteScopeCluster() throws Exception {
|
public void setupSuiteScopeCluster() throws Exception {
|
||||||
|
|
||||||
prepareCreate("idx").addMapping(
|
prepareCreate("idx").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("str_value")
|
.startObject("str_value")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
|
@ -153,7 +151,6 @@ public class CardinalityIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
).get();
|
).get();
|
||||||
|
|
||||||
numDocs = randomIntBetween(2, 100);
|
numDocs = randomIntBetween(2, 100);
|
||||||
|
|
|
@ -139,10 +139,8 @@ public class TopHitsIT extends OpenSearchIntegTestCase {
|
||||||
assertAcked(prepareCreate("field-collapsing").addMapping("type", "group", "type=keyword"));
|
assertAcked(prepareCreate("field-collapsing").addMapping("type", "group", "type=keyword"));
|
||||||
createIndex("empty");
|
createIndex("empty");
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("articles").addMapping(
|
prepareCreate("articles").setMapping(
|
||||||
"article",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("article")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject(TERMS_AGGS_FIELD)
|
.startObject(TERMS_AGGS_FIELD)
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
|
@ -174,7 +172,6 @@ public class TopHitsIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen("idx", "empty", "articles");
|
ensureGreen("idx", "empty", "articles");
|
||||||
|
|
|
@ -556,7 +556,7 @@ public class MaxBucketIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(client().admin().indices().prepareCreate("foo_2").addMapping("doc", builder).get());
|
assertAcked(client().admin().indices().prepareCreate("foo_2").setMapping(builder).get());
|
||||||
|
|
||||||
XContentBuilder docBuilder = jsonBuilder().startObject()
|
XContentBuilder docBuilder = jsonBuilder().startObject()
|
||||||
.startObject("license")
|
.startObject("license")
|
||||||
|
|
|
@ -130,18 +130,15 @@ public class MovAvgIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setupSuiteScopeCluster() throws Exception {
|
public void setupSuiteScopeCluster() throws Exception {
|
||||||
prepareCreate("idx").addMapping(
|
prepareCreate("idx").setMapping(
|
||||||
"type",
|
|
||||||
XContentFactory.jsonBuilder()
|
XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject(VALUE_FIELD)
|
.startObject(VALUE_FIELD)
|
||||||
.field("type", "double")
|
.field("type", "double")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
).execute().get();
|
).execute().get();
|
||||||
createIndex("idx_unmapped");
|
createIndex("idx_unmapped");
|
||||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||||
|
|
|
@ -79,10 +79,8 @@ public class FetchSubPhasePluginIT extends OpenSearchIntegTestCase {
|
||||||
client().admin()
|
client().admin()
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate("test")
|
.prepareCreate("test")
|
||||||
.addMapping(
|
.setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -90,7 +88,6 @@ public class FetchSubPhasePluginIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
|
|
|
@ -100,10 +100,8 @@ public class InnerHitsIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testSimpleNested() throws Exception {
|
public void testSimpleNested() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("articles").addMapping(
|
prepareCreate("articles").setMapping(
|
||||||
"article",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("article")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("comments")
|
.startObject("comments")
|
||||||
.field("type", "nested")
|
.field("type", "nested")
|
||||||
|
@ -119,7 +117,6 @@ public class InnerHitsIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -313,10 +310,8 @@ public class InnerHitsIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testNestedMultipleLayers() throws Exception {
|
public void testNestedMultipleLayers() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("articles").addMapping(
|
prepareCreate("articles").setMapping(
|
||||||
"article",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("article")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("comments")
|
.startObject("comments")
|
||||||
.field("type", "nested")
|
.field("type", "nested")
|
||||||
|
@ -339,7 +334,6 @@ public class InnerHitsIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -583,8 +577,7 @@ public class InnerHitsIT extends OpenSearchIntegTestCase {
|
||||||
// number_of_shards = 1, because then we catch the expected exception in the same way.
|
// number_of_shards = 1, because then we catch the expected exception in the same way.
|
||||||
// (See expectThrows(...) below)
|
// (See expectThrows(...) below)
|
||||||
.setSettings(Settings.builder().put("index.number_of_shards", 1))
|
.setSettings(Settings.builder().put("index.number_of_shards", 1))
|
||||||
.addMapping(
|
.setMapping(
|
||||||
"article",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("comments")
|
.startObject("comments")
|
||||||
|
@ -741,7 +734,6 @@ public class InnerHitsIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testMatchesQueriesNestedInnerHits() throws Exception {
|
public void testMatchesQueriesNestedInnerHits() throws Exception {
|
||||||
XContentBuilder builder = jsonBuilder().startObject()
|
XContentBuilder builder = jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("nested1")
|
.startObject("nested1")
|
||||||
.field("type", "nested")
|
.field("type", "nested")
|
||||||
|
@ -755,9 +747,8 @@ public class InnerHitsIT extends OpenSearchIntegTestCase {
|
||||||
.field("type", "long")
|
.field("type", "long")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", builder));
|
assertAcked(prepareCreate("test").setMapping(builder));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
List<IndexRequestBuilder> requests = new ArrayList<>();
|
List<IndexRequestBuilder> requests = new ArrayList<>();
|
||||||
|
|
|
@ -139,18 +139,16 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
public void testHighlightingWithKeywordIgnoreBoundaryScanner() throws IOException {
|
public void testHighlightingWithKeywordIgnoreBoundaryScanner() throws IOException {
|
||||||
XContentBuilder mappings = jsonBuilder();
|
XContentBuilder mappings = jsonBuilder();
|
||||||
mappings.startObject();
|
mappings.startObject();
|
||||||
mappings.startObject("type")
|
mappings.startObject("properties")
|
||||||
.startObject("properties")
|
|
||||||
.startObject("tags")
|
.startObject("tags")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
.endObject()
|
.endObject()
|
||||||
.startObject("sort")
|
.startObject("sort")
|
||||||
.field("type", "long")
|
.field("type", "long")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
mappings.endObject();
|
mappings.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("type", mappings));
|
assertAcked(prepareCreate("test").setMapping(mappings));
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
.setId("1")
|
.setId("1")
|
||||||
.setSource(jsonBuilder().startObject().array("tags", "foo bar", "foo bar", "foo bar", "foo baz").field("sort", 1).endObject())
|
.setSource(jsonBuilder().startObject().array("tags", "foo bar", "foo bar", "foo bar", "foo baz").field("sort", 1).endObject())
|
||||||
|
@ -176,16 +174,9 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
public void testHighlightingWithStoredKeyword() throws IOException {
|
public void testHighlightingWithStoredKeyword() throws IOException {
|
||||||
XContentBuilder mappings = jsonBuilder();
|
XContentBuilder mappings = jsonBuilder();
|
||||||
mappings.startObject();
|
mappings.startObject();
|
||||||
mappings.startObject("type")
|
mappings.startObject("properties").startObject("text").field("type", "keyword").field("store", true).endObject().endObject();
|
||||||
.startObject("properties")
|
|
||||||
.startObject("text")
|
|
||||||
.field("type", "keyword")
|
|
||||||
.field("store", true)
|
|
||||||
.endObject()
|
|
||||||
.endObject()
|
|
||||||
.endObject();
|
|
||||||
mappings.endObject();
|
mappings.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("type", mappings));
|
assertAcked(prepareCreate("test").setMapping(mappings));
|
||||||
client().prepareIndex("test").setId("1").setSource(jsonBuilder().startObject().field("text", "foo").endObject()).get();
|
client().prepareIndex("test").setId("1").setSource(jsonBuilder().startObject().field("text", "foo").endObject()).get();
|
||||||
refresh();
|
refresh();
|
||||||
SearchResponse search = client().prepareSearch()
|
SearchResponse search = client().prepareSearch()
|
||||||
|
@ -199,18 +190,16 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
// test the kibana case with * as fieldname that will try highlight all fields including meta fields
|
// test the kibana case with * as fieldname that will try highlight all fields including meta fields
|
||||||
XContentBuilder mappings = jsonBuilder();
|
XContentBuilder mappings = jsonBuilder();
|
||||||
mappings.startObject();
|
mappings.startObject();
|
||||||
mappings.startObject("type")
|
mappings.startObject("properties")
|
||||||
.startObject("properties")
|
|
||||||
.startObject("text")
|
.startObject("text")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("analyzer", "keyword")
|
.field("analyzer", "keyword")
|
||||||
.field("index_options", "offsets")
|
.field("index_options", "offsets")
|
||||||
.field("term_vector", "with_positions_offsets")
|
.field("term_vector", "with_positions_offsets")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
mappings.endObject();
|
mappings.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("type", mappings));
|
assertAcked(prepareCreate("test").setMapping(mappings));
|
||||||
client().prepareIndex("test").setId("1").setSource(jsonBuilder().startObject().field("text", "text").endObject()).get();
|
client().prepareIndex("test").setId("1").setSource(jsonBuilder().startObject().field("text", "text").endObject()).get();
|
||||||
refresh();
|
refresh();
|
||||||
for (String type : ALL_TYPES) {
|
for (String type : ALL_TYPES) {
|
||||||
|
@ -224,7 +213,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testFieldAlias() throws IOException {
|
public void testFieldAlias() throws IOException {
|
||||||
XContentBuilder mappings = jsonBuilder().startObject()
|
XContentBuilder mappings = jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("text")
|
.startObject("text")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -236,9 +224,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.field("path", "text")
|
.field("path", "text")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("type", mappings));
|
assertAcked(prepareCreate("test").setMapping(mappings));
|
||||||
|
|
||||||
client().prepareIndex("test").setId("1").setSource("text", "foo").get();
|
client().prepareIndex("test").setId("1").setSource("text", "foo").get();
|
||||||
refresh();
|
refresh();
|
||||||
|
@ -253,7 +240,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testFieldAliasWithSourceLookup() throws IOException {
|
public void testFieldAliasWithSourceLookup() throws IOException {
|
||||||
XContentBuilder mappings = jsonBuilder().startObject()
|
XContentBuilder mappings = jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("text")
|
.startObject("text")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -266,9 +252,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.field("path", "text")
|
.field("path", "text")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("type", mappings));
|
assertAcked(prepareCreate("test").setMapping(mappings));
|
||||||
|
|
||||||
client().prepareIndex("test").setId("1").setSource("text", "foo bar").get();
|
client().prepareIndex("test").setId("1").setSource("text", "foo bar").get();
|
||||||
refresh();
|
refresh();
|
||||||
|
@ -283,7 +268,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testFieldAliasWithWildcardField() throws IOException {
|
public void testFieldAliasWithWildcardField() throws IOException {
|
||||||
XContentBuilder mappings = jsonBuilder().startObject()
|
XContentBuilder mappings = jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("keyword")
|
.startObject("keyword")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
|
@ -293,9 +277,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.field("path", "keyword")
|
.field("path", "keyword")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("type", mappings));
|
assertAcked(prepareCreate("test").setMapping(mappings));
|
||||||
|
|
||||||
client().prepareIndex("test").setId("1").setSource("keyword", "foo").get();
|
client().prepareIndex("test").setId("1").setSource("keyword", "foo").get();
|
||||||
refresh();
|
refresh();
|
||||||
|
@ -308,8 +291,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
public void testHighlightingWhenFieldsAreNotStoredThereIsNoSource() throws IOException {
|
public void testHighlightingWhenFieldsAreNotStoredThereIsNoSource() throws IOException {
|
||||||
XContentBuilder mappings = jsonBuilder();
|
XContentBuilder mappings = jsonBuilder();
|
||||||
mappings.startObject();
|
mappings.startObject();
|
||||||
mappings.startObject("type")
|
mappings.startObject("_source")
|
||||||
.startObject("_source")
|
|
||||||
.field("enabled", false)
|
.field("enabled", false)
|
||||||
.endObject()
|
.endObject()
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
|
@ -325,10 +307,9 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("store", true)
|
.field("store", true)
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
mappings.endObject();
|
mappings.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("type", mappings));
|
assertAcked(prepareCreate("test").setMapping(mappings));
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
.setId("1")
|
.setId("1")
|
||||||
.setSource(jsonBuilder().startObject().field("unstored_text", "text").field("text", "text").endObject())
|
.setSource(jsonBuilder().startObject().field("unstored_text", "text").field("text", "text").endObject())
|
||||||
|
@ -410,10 +391,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testSourceLookupHighlightingUsingPlainHighlighter() throws Exception {
|
public void testSourceLookupHighlightingUsingPlainHighlighter() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
// we don't store title and don't use term vector, now lets see if it works...
|
// we don't store title and don't use term vector, now lets see if it works...
|
||||||
.startObject("title")
|
.startObject("title")
|
||||||
|
@ -432,7 +411,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -480,10 +458,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testSourceLookupHighlightingUsingFastVectorHighlighter() throws Exception {
|
public void testSourceLookupHighlightingUsingFastVectorHighlighter() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
// we don't store title, now lets see if it works...
|
// we don't store title, now lets see if it works...
|
||||||
.startObject("title")
|
.startObject("title")
|
||||||
|
@ -502,7 +478,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -550,10 +525,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testSourceLookupHighlightingUsingPostingsHighlighter() throws Exception {
|
public void testSourceLookupHighlightingUsingPostingsHighlighter() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
// we don't store title, now lets see if it works...
|
// we don't store title, now lets see if it works...
|
||||||
.startObject("title")
|
.startObject("title")
|
||||||
|
@ -572,7 +545,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -771,10 +743,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testForceSourceWithSourceDisabled() throws Exception {
|
public void testForceSourceWithSourceDisabled() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("_source")
|
.startObject("_source")
|
||||||
.field("enabled", false)
|
.field("enabled", false)
|
||||||
.endObject()
|
.endObject()
|
||||||
|
@ -790,7 +760,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -852,7 +821,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFastVectorHighlighter() throws Exception {
|
public void testFastVectorHighlighter() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1TermVectorMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1TermVectorMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
indexRandom(
|
indexRandom(
|
||||||
|
@ -886,7 +855,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHighlighterWithSentenceBoundaryScanner() throws Exception {
|
public void testHighlighterWithSentenceBoundaryScanner() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1TermVectorMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1TermVectorMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
indexRandom(
|
indexRandom(
|
||||||
|
@ -927,7 +896,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHighlighterWithSentenceBoundaryScannerAndLocale() throws Exception {
|
public void testHighlighterWithSentenceBoundaryScannerAndLocale() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1TermVectorMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1TermVectorMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
indexRandom(
|
indexRandom(
|
||||||
|
@ -970,7 +939,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHighlighterWithWordBoundaryScanner() throws Exception {
|
public void testHighlighterWithWordBoundaryScanner() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1TermVectorMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1TermVectorMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
indexRandom(true, client().prepareIndex("test").setSource("field1", "some quick and hairy brown:fox jumped over the lazy dog"));
|
indexRandom(true, client().prepareIndex("test").setSource("field1", "some quick and hairy brown:fox jumped over the lazy dog"));
|
||||||
|
@ -1000,7 +969,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHighlighterWithWordBoundaryScannerAndLocale() throws Exception {
|
public void testHighlighterWithWordBoundaryScannerAndLocale() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1TermVectorMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1TermVectorMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
indexRandom(true, client().prepareIndex("test").setSource("field1", "some quick and hairy brown:fox jumped over the lazy dog"));
|
indexRandom(true, client().prepareIndex("test").setSource("field1", "some quick and hairy brown:fox jumped over the lazy dog"));
|
||||||
|
@ -1034,7 +1003,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
* phraseLimit is not set. Its default is now reasonably low.
|
* phraseLimit is not set. Its default is now reasonably low.
|
||||||
*/
|
*/
|
||||||
public void testFVHManyMatches() throws Exception {
|
public void testFVHManyMatches() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1TermVectorMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1TermVectorMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
// Index one megabyte of "t " over and over and over again
|
// Index one megabyte of "t " over and over and over again
|
||||||
|
@ -1085,11 +1054,9 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
settings.put("index.analysis.analyzer.mock_english.filter", "mock_snowball");
|
settings.put("index.analysis.analyzer.mock_english.filter", "mock_snowball");
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").setSettings(settings)
|
prepareCreate("test").setSettings(settings)
|
||||||
.addMapping(
|
.setMapping(
|
||||||
"type1",
|
|
||||||
XContentFactory.jsonBuilder()
|
XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("foo")
|
.startObject("foo")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -1119,7 +1086,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -1270,7 +1236,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFastVectorHighlighterManyDocs() throws Exception {
|
public void testFastVectorHighlighterManyDocs() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1TermVectorMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1TermVectorMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
int COUNT = between(20, 100);
|
int COUNT = between(20, 100);
|
||||||
|
@ -1297,7 +1263,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
public XContentBuilder type1TermVectorMapping() throws IOException {
|
public XContentBuilder type1TermVectorMapping() throws IOException {
|
||||||
return XContentFactory.jsonBuilder()
|
return XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -1308,7 +1273,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.field("term_vector", "with_positions_offsets")
|
.field("term_vector", "with_positions_offsets")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1406,10 +1370,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testMultiMapperVectorWithStore() throws Exception {
|
public void testMultiMapperVectorWithStore() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("title")
|
.startObject("title")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -1427,7 +1389,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -1453,10 +1414,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testMultiMapperVectorFromSource() throws Exception {
|
public void testMultiMapperVectorFromSource() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("title")
|
.startObject("title")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -1474,7 +1433,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -1501,10 +1459,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testMultiMapperNoVectorWithStore() throws Exception {
|
public void testMultiMapperNoVectorWithStore() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("title")
|
.startObject("title")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -1522,7 +1478,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1549,10 +1504,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testMultiMapperNoVectorFromSource() throws Exception {
|
public void testMultiMapperNoVectorFromSource() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("title")
|
.startObject("title")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -1570,7 +1523,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -1739,7 +1691,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBoostingQueryTermVector() throws IOException {
|
public void testBoostingQueryTermVector() throws IOException {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1TermVectorMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1TermVectorMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
client().prepareIndex("test").setSource("field1", "this is a test", "field2", "The quick brown fox jumps over the lazy dog").get();
|
client().prepareIndex("test").setSource("field1", "this is a test", "field2", "The quick brown fox jumps over the lazy dog").get();
|
||||||
refresh();
|
refresh();
|
||||||
|
@ -1770,7 +1722,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCommonTermsTermVector() throws IOException {
|
public void testCommonTermsTermVector() throws IOException {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1TermVectorMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1TermVectorMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test").setSource("field1", "this is a test", "field2", "The quick brown fox jumps over the lazy dog").get();
|
client().prepareIndex("test").setSource("field1", "this is a test", "field2", "The quick brown fox jumps over the lazy dog").get();
|
||||||
|
@ -2278,7 +2230,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighter() throws Exception {
|
public void testPostingsHighlighter() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
|
@ -2349,7 +2301,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighterMultipleFields() throws Exception {
|
public void testPostingsHighlighterMultipleFields() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()).get());
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()).get());
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
index(
|
index(
|
||||||
|
@ -2371,7 +2323,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighterNumberOfFragments() throws Exception {
|
public void testPostingsHighlighterNumberOfFragments() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
|
@ -2457,7 +2409,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
public void testMultiMatchQueryHighlight() throws IOException {
|
public void testMultiMatchQueryHighlight() throws IOException {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -2470,9 +2421,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.field("term_vector", "with_positions_offsets")
|
.field("term_vector", "with_positions_offsets")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", mapping));
|
assertAcked(prepareCreate("test").setMapping(mapping));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
.setSource("field1", "The quick brown fox jumps over", "field2", "The quick brown fox jumps over")
|
.setSource("field1", "The quick brown fox jumps over", "field2", "The quick brown fox jumps over")
|
||||||
|
@ -2507,7 +2457,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighterOrderByScore() throws Exception {
|
public void testPostingsHighlighterOrderByScore() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
|
@ -2585,10 +2535,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testPostingsHighlighterMultiMapperWithStore() throws Exception {
|
public void testPostingsHighlighterMultiMapperWithStore() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("title")
|
.startObject("title")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -2606,7 +2554,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -2645,10 +2592,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testPostingsHighlighterMultiMapperFromSource() throws Exception {
|
public void testPostingsHighlighterMultiMapperFromSource() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("title")
|
.startObject("title")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -2666,7 +2611,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -2693,10 +2637,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testPostingsHighlighterShouldFailIfNoOffsets() throws Exception {
|
public void testPostingsHighlighterShouldFailIfNoOffsets() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("title")
|
.startObject("title")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -2705,7 +2647,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -2726,7 +2667,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighterBoostingQuery() throws IOException {
|
public void testPostingsHighlighterBoostingQuery() throws IOException {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
.setSource("field1", "this is a test", "field2", "The quick brown fox jumps over the lazy dog! Second sentence.")
|
.setSource("field1", "this is a test", "field2", "The quick brown fox jumps over the lazy dog! Second sentence.")
|
||||||
|
@ -2743,7 +2684,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighterCommonTermsQuery() throws IOException {
|
public void testPostingsHighlighterCommonTermsQuery() throws IOException {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
|
@ -2770,7 +2711,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
private static XContentBuilder type1PostingsffsetsMapping() throws IOException {
|
private static XContentBuilder type1PostingsffsetsMapping() throws IOException {
|
||||||
return XContentFactory.jsonBuilder()
|
return XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -2781,12 +2721,11 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.field("index_options", "offsets")
|
.field("index_options", "offsets")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighterPrefixQuery() throws Exception {
|
public void testPostingsHighlighterPrefixQuery() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
|
@ -2808,7 +2747,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighterFuzzyQuery() throws Exception {
|
public void testPostingsHighlighterFuzzyQuery() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
|
@ -2831,7 +2770,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighterRegexpQuery() throws Exception {
|
public void testPostingsHighlighterRegexpQuery() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
|
@ -2854,7 +2793,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighterWildcardQuery() throws Exception {
|
public void testPostingsHighlighterWildcardQuery() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
|
@ -2890,7 +2829,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighterTermRangeQuery() throws Exception {
|
public void testPostingsHighlighterTermRangeQuery() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test").setSource("field1", "this is a test", "field2", "aaab").get();
|
client().prepareIndex("test").setSource("field1", "this is a test", "field2", "aaab").get();
|
||||||
|
@ -2905,7 +2844,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighterQueryString() throws Exception {
|
public void testPostingsHighlighterQueryString() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
|
@ -2928,7 +2867,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighterRegexpQueryWithinConstantScoreQuery() throws Exception {
|
public void testPostingsHighlighterRegexpQueryWithinConstantScoreQuery() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test").setSource("field1", "The photography word will get highlighted").get();
|
client().prepareIndex("test").setSource("field1", "The photography word will get highlighted").get();
|
||||||
|
@ -2942,7 +2881,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighterMultiTermQueryMultipleLevels() throws Exception {
|
public void testPostingsHighlighterMultiTermQueryMultipleLevels() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test").setSource("field1", "The photography word will get highlighted").get();
|
client().prepareIndex("test").setSource("field1", "The photography word will get highlighted").get();
|
||||||
|
@ -2959,7 +2898,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighterPrefixQueryWithinBooleanQuery() throws Exception {
|
public void testPostingsHighlighterPrefixQueryWithinBooleanQuery() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test").setSource("field1", "The photography word will get highlighted").get();
|
client().prepareIndex("test").setSource("field1", "The photography word will get highlighted").get();
|
||||||
|
@ -2974,7 +2913,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighterQueryStringWithinFilteredQuery() throws Exception {
|
public void testPostingsHighlighterQueryStringWithinFilteredQuery() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test").setSource("field1", "The photography word will get highlighted").get();
|
client().prepareIndex("test").setSource("field1", "The photography word will get highlighted").get();
|
||||||
|
@ -2989,7 +2928,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPostingsHighlighterManyDocs() throws Exception {
|
public void testPostingsHighlighterManyDocs() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1PostingsffsetsMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1PostingsffsetsMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
int COUNT = between(20, 100);
|
int COUNT = between(20, 100);
|
||||||
|
@ -3025,7 +2964,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
public void testDoesNotHighlightTypeName() throws Exception {
|
public void testDoesNotHighlightTypeName() throws Exception {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("typename")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("foo")
|
.startObject("foo")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -3033,9 +2971,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.field("term_vector", "with_positions_offsets")
|
.field("term_vector", "with_positions_offsets")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("typename", mapping));
|
assertAcked(prepareCreate("test").setMapping(mapping));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
indexRandom(true, client().prepareIndex("test").setSource("foo", "test typename"));
|
indexRandom(true, client().prepareIndex("test").setSource("foo", "test typename"));
|
||||||
|
@ -3052,7 +2989,6 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
public void testDoesNotHighlightAliasFilters() throws Exception {
|
public void testDoesNotHighlightAliasFilters() throws Exception {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("typename")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("foo")
|
.startObject("foo")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -3060,9 +2996,8 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.field("term_vector", "with_positions_offsets")
|
.field("term_vector", "with_positions_offsets")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("typename", mapping));
|
assertAcked(prepareCreate("test").setMapping(mapping));
|
||||||
assertAcked(client().admin().indices().prepareAliases().addAlias("test", "filtered_alias", matchQuery("foo", "japanese")));
|
assertAcked(client().admin().indices().prepareAliases().addAlias("test", "filtered_alias", matchQuery("foo", "japanese")));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
|
@ -3078,7 +3013,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFastVectorHighlighterPhraseBoost() throws Exception {
|
public void testFastVectorHighlighterPhraseBoost() throws Exception {
|
||||||
assertAcked(prepareCreate("test").addMapping("type1", type1TermVectorMapping()));
|
assertAcked(prepareCreate("test").setMapping(type1TermVectorMapping()));
|
||||||
phraseBoostTestCase("fvh");
|
phraseBoostTestCase("fvh");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3174,8 +3109,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
// see https://github.com/elastic/elasticsearch/issues/17537
|
// see https://github.com/elastic/elasticsearch/issues/17537
|
||||||
XContentBuilder mappings = jsonBuilder();
|
XContentBuilder mappings = jsonBuilder();
|
||||||
mappings.startObject();
|
mappings.startObject();
|
||||||
mappings.startObject("type")
|
mappings.startObject("properties")
|
||||||
.startObject("properties")
|
|
||||||
.startObject("geo_point")
|
.startObject("geo_point")
|
||||||
.field("type", "geo_point")
|
.field("type", "geo_point")
|
||||||
.endObject()
|
.endObject()
|
||||||
|
@ -3184,10 +3118,9 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
.field("term_vector", "with_positions_offsets_payloads")
|
.field("term_vector", "with_positions_offsets_payloads")
|
||||||
.field("index_options", "offsets")
|
.field("index_options", "offsets")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
mappings.endObject();
|
mappings.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("type", mappings));
|
assertAcked(prepareCreate("test").setMapping(mappings));
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
.setId("1")
|
.setId("1")
|
||||||
|
@ -3216,18 +3149,16 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
// see https://github.com/elastic/elasticsearch/issues/17537#issuecomment-244939633
|
// see https://github.com/elastic/elasticsearch/issues/17537#issuecomment-244939633
|
||||||
XContentBuilder mappings = jsonBuilder();
|
XContentBuilder mappings = jsonBuilder();
|
||||||
mappings.startObject();
|
mappings.startObject();
|
||||||
mappings.startObject("jobs")
|
mappings.startObject("properties")
|
||||||
.startObject("properties")
|
|
||||||
.startObject("loc")
|
.startObject("loc")
|
||||||
.field("type", "geo_point")
|
.field("type", "geo_point")
|
||||||
.endObject()
|
.endObject()
|
||||||
.startObject("jd")
|
.startObject("jd")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
mappings.endObject();
|
mappings.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("jobs", mappings));
|
assertAcked(prepareCreate("test").setMapping(mappings));
|
||||||
ensureYellow();
|
ensureYellow();
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
|
@ -3259,15 +3190,9 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
// check that keyword highlighting works
|
// check that keyword highlighting works
|
||||||
XContentBuilder mappings = jsonBuilder();
|
XContentBuilder mappings = jsonBuilder();
|
||||||
mappings.startObject();
|
mappings.startObject();
|
||||||
mappings.startObject("type")
|
mappings.startObject("properties").startObject("keyword_field").field("type", "keyword").endObject().endObject();
|
||||||
.startObject("properties")
|
|
||||||
.startObject("keyword_field")
|
|
||||||
.field("type", "keyword")
|
|
||||||
.endObject()
|
|
||||||
.endObject()
|
|
||||||
.endObject();
|
|
||||||
mappings.endObject();
|
mappings.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("type", mappings));
|
assertAcked(prepareCreate("test").setMapping(mappings));
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
.setId("1")
|
.setId("1")
|
||||||
|
@ -3299,7 +3224,7 @@ public class HighlighterSearchIT extends OpenSearchIntegTestCase {
|
||||||
// If field is not stored, it is looked up in source (but source has only 'foo'
|
// If field is not stored, it is looked up in source (but source has only 'foo'
|
||||||
b.startObject("foo_copy").field("type", "text").field("store", true).endObject();
|
b.startObject("foo_copy").field("type", "text").field("store", true).endObject();
|
||||||
b.endObject().endObject();
|
b.endObject().endObject();
|
||||||
prepareCreate("test").addMapping("type", b).get();
|
prepareCreate("test").setMapping(b).get();
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
.setId("1")
|
.setId("1")
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class FieldCapabilitiesIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("old_index").addMapping("_doc", oldIndexMapping));
|
assertAcked(prepareCreate("old_index").setMapping(oldIndexMapping));
|
||||||
|
|
||||||
XContentBuilder newIndexMapping = XContentFactory.jsonBuilder()
|
XContentBuilder newIndexMapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
|
@ -106,7 +106,7 @@ public class FieldCapabilitiesIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("new_index").addMapping("_doc", newIndexMapping));
|
assertAcked(prepareCreate("new_index").setMapping(newIndexMapping));
|
||||||
assertAcked(client().admin().indices().prepareAliases().addAlias("new_index", "current"));
|
assertAcked(client().admin().indices().prepareAliases().addAlias("new_index", "current"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -774,10 +774,8 @@ public class SearchFieldsIT extends OpenSearchIntegTestCase {
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate("my-index")
|
.prepareCreate("my-index")
|
||||||
.setSettings(Settings.builder().put("index.refresh_interval", -1))
|
.setSettings(Settings.builder().put("index.refresh_interval", -1))
|
||||||
.addMapping(
|
.setMapping(
|
||||||
MapperService.SINGLE_MAPPING_NAME,
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject(MapperService.SINGLE_MAPPING_NAME)
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "object")
|
.field("type", "object")
|
||||||
|
@ -800,7 +798,6 @@ public class SearchFieldsIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
|
@ -1181,7 +1178,6 @@ public class SearchFieldsIT extends OpenSearchIntegTestCase {
|
||||||
public void testDocValueFieldsWithFieldAlias() throws Exception {
|
public void testDocValueFieldsWithFieldAlias() throws Exception {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject(MapperService.SINGLE_MAPPING_NAME)
|
|
||||||
.startObject("_source")
|
.startObject("_source")
|
||||||
.field("enabled", false)
|
.field("enabled", false)
|
||||||
.endObject()
|
.endObject()
|
||||||
|
@ -1203,9 +1199,8 @@ public class SearchFieldsIT extends OpenSearchIntegTestCase {
|
||||||
.field("path", "date_field")
|
.field("path", "date_field")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping(MapperService.SINGLE_MAPPING_NAME, mapping));
|
assertAcked(prepareCreate("test").setMapping(mapping));
|
||||||
ensureGreen("test");
|
ensureGreen("test");
|
||||||
|
|
||||||
DateTime date = new DateTime(1990, 12, 29, 0, 0, DateTimeZone.UTC);
|
DateTime date = new DateTime(1990, 12, 29, 0, 0, DateTimeZone.UTC);
|
||||||
|
@ -1244,7 +1239,6 @@ public class SearchFieldsIT extends OpenSearchIntegTestCase {
|
||||||
public void testWildcardDocValueFieldsWithFieldAlias() throws Exception {
|
public void testWildcardDocValueFieldsWithFieldAlias() throws Exception {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject(MapperService.SINGLE_MAPPING_NAME)
|
|
||||||
.startObject("_source")
|
.startObject("_source")
|
||||||
.field("enabled", false)
|
.field("enabled", false)
|
||||||
.endObject()
|
.endObject()
|
||||||
|
@ -1266,9 +1260,8 @@ public class SearchFieldsIT extends OpenSearchIntegTestCase {
|
||||||
.field("path", "date_field")
|
.field("path", "date_field")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping(MapperService.SINGLE_MAPPING_NAME, mapping));
|
assertAcked(prepareCreate("test").setMapping(mapping));
|
||||||
ensureGreen("test");
|
ensureGreen("test");
|
||||||
|
|
||||||
DateTime date = new DateTime(1990, 12, 29, 0, 0, DateTimeZone.UTC);
|
DateTime date = new DateTime(1990, 12, 29, 0, 0, DateTimeZone.UTC);
|
||||||
|
@ -1306,7 +1299,6 @@ public class SearchFieldsIT extends OpenSearchIntegTestCase {
|
||||||
public void testStoredFieldsWithFieldAlias() throws Exception {
|
public void testStoredFieldsWithFieldAlias() throws Exception {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject(MapperService.SINGLE_MAPPING_NAME)
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -1325,9 +1317,8 @@ public class SearchFieldsIT extends OpenSearchIntegTestCase {
|
||||||
.field("path", "field2")
|
.field("path", "field2")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping(MapperService.SINGLE_MAPPING_NAME, mapping));
|
assertAcked(prepareCreate("test").setMapping(mapping));
|
||||||
|
|
||||||
index("test", MapperService.SINGLE_MAPPING_NAME, "1", "field1", "value1", "field2", "value2");
|
index("test", MapperService.SINGLE_MAPPING_NAME, "1", "field1", "value1", "field2", "value2");
|
||||||
refresh("test");
|
refresh("test");
|
||||||
|
@ -1350,7 +1341,6 @@ public class SearchFieldsIT extends OpenSearchIntegTestCase {
|
||||||
public void testWildcardStoredFieldsWithFieldAlias() throws Exception {
|
public void testWildcardStoredFieldsWithFieldAlias() throws Exception {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject(MapperService.SINGLE_MAPPING_NAME)
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -1369,9 +1359,8 @@ public class SearchFieldsIT extends OpenSearchIntegTestCase {
|
||||||
.field("path", "field2")
|
.field("path", "field2")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping(MapperService.SINGLE_MAPPING_NAME, mapping));
|
assertAcked(prepareCreate("test").setMapping(mapping));
|
||||||
|
|
||||||
index("test", MapperService.SINGLE_MAPPING_NAME, "1", "field1", "value1", "field2", "value2");
|
index("test", MapperService.SINGLE_MAPPING_NAME, "1", "field1", "value1", "field2", "value2");
|
||||||
refresh("test");
|
refresh("test");
|
||||||
|
|
|
@ -96,10 +96,8 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testDistanceScoreGeoLinGaussExp() throws Exception {
|
public void testDistanceScoreGeoLinGaussExp() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -109,7 +107,6 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -223,10 +220,8 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testDistanceScoreGeoLinGaussExpWithOffset() throws Exception {
|
public void testDistanceScoreGeoLinGaussExpWithOffset() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -236,7 +231,6 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -337,10 +331,8 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
Settings settings = Settings.builder().put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1).build();
|
Settings settings = Settings.builder().put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1).build();
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").setSettings(settings)
|
prepareCreate("test").setSettings(settings)
|
||||||
.addMapping(
|
.setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -350,7 +342,6 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -436,10 +427,8 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testParseGeoPoint() throws Exception {
|
public void testParseGeoPoint() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -449,7 +438,6 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -504,10 +492,8 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testCombineModes() throws Exception {
|
public void testCombineModes() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -517,7 +503,6 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -621,10 +606,8 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testCombineModesExplain() throws Exception {
|
public void testCombineModesExplain() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -634,7 +617,6 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -691,10 +673,8 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testExceptionThrownIfScaleLE0() throws Exception {
|
public void testExceptionThrownIfScaleLE0() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -704,7 +684,6 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
client().index(
|
client().index(
|
||||||
|
@ -731,10 +710,8 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testParseDateMath() throws Exception {
|
public void testParseDateMath() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -745,7 +722,6 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
client().index(
|
client().index(
|
||||||
|
@ -785,10 +761,8 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testValueMissingLin() throws Exception {
|
public void testValueMissingLin() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -801,7 +775,6 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -854,10 +827,8 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
ZonedDateTime dt = ZonedDateTime.now(ZoneOffset.UTC);
|
ZonedDateTime dt = ZonedDateTime.now(ZoneOffset.UTC);
|
||||||
|
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -867,7 +838,6 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -933,7 +903,6 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
Version version = VersionUtils.randomIndexCompatibleVersion(random());
|
Version version = VersionUtils.randomIndexCompatibleVersion(random());
|
||||||
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
||||||
XContentBuilder xContentBuilder = jsonBuilder().startObject()
|
XContentBuilder xContentBuilder = jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -949,8 +918,8 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
.startObject("geo")
|
.startObject("geo")
|
||||||
.field("type", "geo_point")
|
.field("type", "geo_point")
|
||||||
.field("ignore_malformed", true);
|
.field("ignore_malformed", true);
|
||||||
xContentBuilder.endObject().endObject().endObject().endObject();
|
xContentBuilder.endObject().endObject().endObject();
|
||||||
assertAcked(prepareCreate("test").setSettings(settings).addMapping("type", xContentBuilder));
|
assertAcked(prepareCreate("test").setSettings(settings).setMapping(xContentBuilder));
|
||||||
int numDocs = 200;
|
int numDocs = 200;
|
||||||
List<IndexRequestBuilder> indexBuilders = new ArrayList<>();
|
List<IndexRequestBuilder> indexBuilders = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -1013,10 +982,8 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testParsingExceptionIfFieldDoesNotExist() throws Exception {
|
public void testParsingExceptionIfFieldDoesNotExist() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -1026,7 +993,6 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
int numDocs = 2;
|
int numDocs = 2;
|
||||||
|
@ -1066,10 +1032,8 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testParsingExceptionIfFieldTypeDoesNotMatch() throws Exception {
|
public void testParsingExceptionIfFieldTypeDoesNotMatch() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -1079,7 +1043,6 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
client().index(
|
client().index(
|
||||||
|
@ -1105,10 +1068,8 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testNoQueryGiven() throws Exception {
|
public void testNoQueryGiven() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -1118,7 +1079,6 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
client().index(indexRequest("test").source(jsonBuilder().startObject().field("test", "value").field("num", 1.0).endObject()))
|
client().index(indexRequest("test").source(jsonBuilder().startObject().field("test", "value").field("num", 1.0).endObject()))
|
||||||
|
@ -1138,10 +1098,8 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testMultiFieldOptions() throws Exception {
|
public void testMultiFieldOptions() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -1154,7 +1112,6 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1271,10 +1228,8 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testDistanceScoreGeoLinGaussExplain() throws Exception {
|
public void testDistanceScoreGeoLinGaussExplain() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -1284,7 +1239,6 @@ public class DecayFunctionScoreIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -57,10 +57,8 @@ import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertOrderedSea
|
||||||
public class FunctionScoreFieldValueIT extends OpenSearchIntegTestCase {
|
public class FunctionScoreFieldValueIT extends OpenSearchIntegTestCase {
|
||||||
public void testFieldValueFactor() throws IOException {
|
public void testFieldValueFactor() throws IOException {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", randomFrom(new String[] { "short", "float", "long", "integer", "double" }))
|
.field("type", randomFrom(new String[] { "short", "float", "long", "integer", "double" }))
|
||||||
|
@ -70,7 +68,6 @@ public class FunctionScoreFieldValueIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
).get()
|
).get()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -169,10 +166,8 @@ public class FunctionScoreFieldValueIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testFieldValueFactorExplain() throws IOException {
|
public void testFieldValueFactorExplain() throws IOException {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", randomFrom(new String[] { "short", "float", "long", "integer", "double" }))
|
.field("type", randomFrom(new String[] { "short", "float", "long", "integer", "double" }))
|
||||||
|
@ -182,7 +177,6 @@ public class FunctionScoreFieldValueIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
).get()
|
).get()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -76,10 +76,8 @@ public class FunctionScorePluginIT extends OpenSearchIntegTestCase {
|
||||||
client().admin()
|
client().admin()
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate("test")
|
.prepareCreate("test")
|
||||||
.addMapping(
|
.setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("test")
|
.startObject("test")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -89,7 +87,6 @@ public class FunctionScorePluginIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().get();
|
client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().get();
|
||||||
|
|
|
@ -127,10 +127,8 @@ public class QueryRescorerIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testRescorePhrase() throws Exception {
|
public void testRescorePhrase() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("analyzer", "whitespace")
|
.field("analyzer", "whitespace")
|
||||||
|
@ -138,7 +136,6 @@ public class QueryRescorerIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
).setSettings(Settings.builder().put(indexSettings()).put("index.number_of_shards", 1))
|
).setSettings(Settings.builder().put(indexSettings()).put("index.number_of_shards", 1))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -190,22 +187,16 @@ public class QueryRescorerIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("analyzer", "whitespace")
|
.field("analyzer", "whitespace")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
assertAcked(
|
assertAcked(
|
||||||
client().admin()
|
client().admin().indices().prepareCreate("test").setMapping(mapping).setSettings(builder.put("index.number_of_shards", 1))
|
||||||
.indices()
|
|
||||||
.prepareCreate("test")
|
|
||||||
.addMapping("type1", mapping)
|
|
||||||
.setSettings(builder.put("index.number_of_shards", 1))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
client().prepareIndex("test").setId("1").setSource("field1", "massachusetts avenue boston massachusetts").get();
|
client().prepareIndex("test").setId("1").setSource("field1", "massachusetts avenue boston massachusetts").get();
|
||||||
|
@ -285,22 +276,16 @@ public class QueryRescorerIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("analyzer", "whitespace")
|
.field("analyzer", "whitespace")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
assertAcked(
|
assertAcked(
|
||||||
client().admin()
|
client().admin().indices().prepareCreate("test").setMapping(mapping).setSettings(builder.put("index.number_of_shards", 1))
|
||||||
.indices()
|
|
||||||
.prepareCreate("test")
|
|
||||||
.addMapping("type1", mapping)
|
|
||||||
.setSettings(builder.put("index.number_of_shards", 1))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
client().prepareIndex("test").setId("3").setSource("field1", "massachusetts").get();
|
client().prepareIndex("test").setId("3").setSource("field1", "massachusetts").get();
|
||||||
|
@ -371,22 +356,16 @@ public class QueryRescorerIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("analyzer", "whitespace")
|
.field("analyzer", "whitespace")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
assertAcked(
|
assertAcked(
|
||||||
client().admin()
|
client().admin().indices().prepareCreate("test").setMapping(mapping).setSettings(builder.put("index.number_of_shards", 1))
|
||||||
.indices()
|
|
||||||
.prepareCreate("test")
|
|
||||||
.addMapping("type1", mapping)
|
|
||||||
.setSettings(builder.put("index.number_of_shards", 1))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
client().prepareIndex("test").setId("3").setSource("field1", "massachusetts").get();
|
client().prepareIndex("test").setId("3").setSource("field1", "massachusetts").get();
|
||||||
|
@ -524,10 +503,8 @@ public class QueryRescorerIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testExplain() throws Exception {
|
public void testExplain() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("analyzer", "whitespace")
|
.field("analyzer", "whitespace")
|
||||||
|
@ -535,7 +512,6 @@ public class QueryRescorerIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -785,10 +761,8 @@ public class QueryRescorerIT extends OpenSearchIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("analyzer", analyzer)
|
.field("analyzer", analyzer)
|
||||||
|
@ -796,7 +770,6 @@ public class QueryRescorerIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
).setSettings(builder)
|
).setSettings(builder)
|
||||||
);
|
);
|
||||||
int numDocs = randomIntBetween(100, 150);
|
int numDocs = randomIntBetween(100, 150);
|
||||||
|
|
|
@ -64,12 +64,11 @@ public class GeoBoundingBoxQueryIT extends OpenSearchIntegTestCase {
|
||||||
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
||||||
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("location")
|
.startObject("location")
|
||||||
.field("type", "geo_point");
|
.field("type", "geo_point");
|
||||||
xContentBuilder.endObject().endObject().endObject().endObject();
|
xContentBuilder.endObject().endObject().endObject();
|
||||||
assertAcked(prepareCreate("test").setSettings(settings).addMapping("type1", xContentBuilder));
|
assertAcked(prepareCreate("test").setSettings(settings).setMapping(xContentBuilder));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
|
@ -195,12 +194,11 @@ public class GeoBoundingBoxQueryIT extends OpenSearchIntegTestCase {
|
||||||
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
||||||
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("location")
|
.startObject("location")
|
||||||
.field("type", "geo_point");
|
.field("type", "geo_point");
|
||||||
xContentBuilder.endObject().endObject().endObject().endObject();
|
xContentBuilder.endObject().endObject().endObject();
|
||||||
assertAcked(prepareCreate("test").setSettings(settings).addMapping("type1", xContentBuilder));
|
assertAcked(prepareCreate("test").setSettings(settings).setMapping(xContentBuilder));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
|
@ -275,12 +273,11 @@ public class GeoBoundingBoxQueryIT extends OpenSearchIntegTestCase {
|
||||||
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
||||||
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("location")
|
.startObject("location")
|
||||||
.field("type", "geo_point");
|
.field("type", "geo_point");
|
||||||
xContentBuilder.endObject().endObject().endObject().endObject();
|
xContentBuilder.endObject().endObject().endObject();
|
||||||
assertAcked(prepareCreate("test").setSettings(settings).addMapping("type1", xContentBuilder));
|
assertAcked(prepareCreate("test").setSettings(settings).setMapping(xContentBuilder));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
|
|
|
@ -124,12 +124,11 @@ public class GeoDistanceIT extends OpenSearchIntegTestCase {
|
||||||
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
||||||
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("location")
|
.startObject("location")
|
||||||
.field("type", "geo_point");
|
.field("type", "geo_point");
|
||||||
xContentBuilder.endObject().endObject().endObject().endObject();
|
xContentBuilder.endObject().endObject().endObject();
|
||||||
assertAcked(prepareCreate("test").setSettings(settings).addMapping("type1", xContentBuilder));
|
assertAcked(prepareCreate("test").setSettings(settings).setMapping(xContentBuilder));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -393,7 +393,6 @@ public class GeoFilterIT extends OpenSearchIntegTestCase {
|
||||||
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
||||||
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("country")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("pin")
|
.startObject("pin")
|
||||||
.field("type", "geo_point");
|
.field("type", "geo_point");
|
||||||
|
@ -404,10 +403,9 @@ public class GeoFilterIT extends OpenSearchIntegTestCase {
|
||||||
.field("ignore_malformed", true)
|
.field("ignore_malformed", true)
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
client().admin().indices().prepareCreate("countries").setSettings(settings).addMapping("country", xContentBuilder).get();
|
client().admin().indices().prepareCreate("countries").setSettings(settings).setMapping(xContentBuilder).get();
|
||||||
BulkResponse bulk = client().prepareBulk().add(bulkAction, 0, bulkAction.length, null, xContentBuilder.contentType()).get();
|
BulkResponse bulk = client().prepareBulk().add(bulkAction, 0, bulkAction.length, null, xContentBuilder.contentType()).get();
|
||||||
|
|
||||||
for (BulkItemResponse item : bulk.getItems()) {
|
for (BulkItemResponse item : bulk.getItems()) {
|
||||||
|
|
|
@ -86,17 +86,14 @@ public class MoreLikeThisIT extends OpenSearchIntegTestCase {
|
||||||
public void testSimpleMoreLikeThis() throws Exception {
|
public void testSimpleMoreLikeThis() throws Exception {
|
||||||
logger.info("Creating index test");
|
logger.info("Creating index test");
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("text")
|
.startObject("text")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -119,17 +116,14 @@ public class MoreLikeThisIT extends OpenSearchIntegTestCase {
|
||||||
public void testSimpleMoreLikeThisWithTypes() throws Exception {
|
public void testSimpleMoreLikeThisWithTypes() throws Exception {
|
||||||
logger.info("Creating index test");
|
logger.info("Creating index test");
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("text")
|
.startObject("text")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -151,10 +145,8 @@ public class MoreLikeThisIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
// Issue #30148
|
// Issue #30148
|
||||||
public void testMoreLikeThisForZeroTokensInOneOfTheAnalyzedFields() throws Exception {
|
public void testMoreLikeThisForZeroTokensInOneOfTheAnalyzedFields() throws Exception {
|
||||||
CreateIndexRequestBuilder createIndexRequestBuilder = prepareCreate("test").addMapping(
|
CreateIndexRequestBuilder createIndexRequestBuilder = prepareCreate("test").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("myField")
|
.startObject("myField")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -164,7 +156,6 @@ public class MoreLikeThisIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
assertAcked(createIndexRequestBuilder);
|
assertAcked(createIndexRequestBuilder);
|
||||||
|
@ -214,17 +205,14 @@ public class MoreLikeThisIT extends OpenSearchIntegTestCase {
|
||||||
public void testMoreLikeThisWithAliases() throws Exception {
|
public void testMoreLikeThisWithAliases() throws Exception {
|
||||||
logger.info("Creating index test");
|
logger.info("Creating index test");
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("text")
|
.startObject("text")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
logger.info("Creating aliases alias release");
|
logger.info("Creating aliases alias release");
|
||||||
|
@ -370,10 +358,8 @@ public class MoreLikeThisIT extends OpenSearchIntegTestCase {
|
||||||
// Issue #3252
|
// Issue #3252
|
||||||
public void testNumericField() throws Exception {
|
public void testNumericField() throws Exception {
|
||||||
final String[] numericTypes = new String[] { "byte", "short", "integer", "long" };
|
final String[] numericTypes = new String[] { "byte", "short", "integer", "long" };
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("int_value")
|
.startObject("int_value")
|
||||||
.field("type", randomFrom(numericTypes))
|
.field("type", randomFrom(numericTypes))
|
||||||
|
@ -383,7 +369,6 @@ public class MoreLikeThisIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
).get();
|
).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
|
@ -486,7 +471,6 @@ public class MoreLikeThisIT extends OpenSearchIntegTestCase {
|
||||||
public void testMoreLikeThisWithFieldAlias() throws Exception {
|
public void testMoreLikeThisWithFieldAlias() throws Exception {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("_doc")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("text")
|
.startObject("text")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -496,10 +480,9 @@ public class MoreLikeThisIT extends OpenSearchIntegTestCase {
|
||||||
.field("path", "text")
|
.field("path", "text")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
assertAcked(prepareCreate("test").addMapping("_doc", mapping));
|
assertAcked(prepareCreate("test").setMapping(mapping));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
index("test", "_doc", "1", "text", "lucene");
|
index("test", "_doc", "1", "text", "lucene");
|
||||||
|
@ -517,17 +500,14 @@ public class MoreLikeThisIT extends OpenSearchIntegTestCase {
|
||||||
public void testSimpleMoreLikeInclude() throws Exception {
|
public void testSimpleMoreLikeInclude() throws Exception {
|
||||||
logger.info("Creating index test");
|
logger.info("Creating index test");
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("text")
|
.startObject("text")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -584,17 +564,14 @@ public class MoreLikeThisIT extends OpenSearchIntegTestCase {
|
||||||
public void testSimpleMoreLikeThisIds() throws Exception {
|
public void testSimpleMoreLikeThisIds() throws Exception {
|
||||||
logger.info("Creating index test");
|
logger.info("Creating index test");
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("text")
|
.startObject("text")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -867,10 +844,8 @@ public class MoreLikeThisIT extends OpenSearchIntegTestCase {
|
||||||
public void testWithMissingRouting() throws IOException {
|
public void testWithMissingRouting() throws IOException {
|
||||||
logger.info("Creating index test with routing required for type1");
|
logger.info("Creating index test with routing required for type1");
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("text")
|
.startObject("text")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -880,7 +855,6 @@ public class MoreLikeThisIT extends OpenSearchIntegTestCase {
|
||||||
.field("required", true)
|
.field("required", true)
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -213,10 +213,8 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testMultiNested() throws Exception {
|
public void testMultiNested() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("nested1")
|
.startObject("nested1")
|
||||||
.field("type", "nested")
|
.field("type", "nested")
|
||||||
|
@ -228,7 +226,6 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -371,10 +368,8 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
|
||||||
public void testDeleteNestedDocsWithAlias() throws Exception {
|
public void testDeleteNestedDocsWithAlias() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).put("index.refresh_interval", -1).build())
|
prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).put("index.refresh_interval", -1).build())
|
||||||
.addMapping(
|
.setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -384,7 +379,6 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -437,17 +431,14 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testExplain() throws Exception {
|
public void testExplain() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("nested1")
|
.startObject("nested1")
|
||||||
.field("type", "nested")
|
.field("type", "nested")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -485,10 +476,8 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
|
||||||
public void testSimpleNestedSorting() throws Exception {
|
public void testSimpleNestedSorting() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).put("index.refresh_interval", -1))
|
prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).put("index.refresh_interval", -1))
|
||||||
.addMapping(
|
.setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("nested1")
|
.startObject("nested1")
|
||||||
.field("type", "nested")
|
.field("type", "nested")
|
||||||
|
@ -501,7 +490,6 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -586,10 +574,8 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
|
||||||
public void testSimpleNestedSortingWithNestedFilterMissing() throws Exception {
|
public void testSimpleNestedSortingWithNestedFilterMissing() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).put("index.refresh_interval", -1))
|
prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).put("index.refresh_interval", -1))
|
||||||
.addMapping(
|
.setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("nested1")
|
.startObject("nested1")
|
||||||
.field("type", "nested")
|
.field("type", "nested")
|
||||||
|
@ -604,7 +590,6 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -1048,11 +1033,9 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testSortNestedWithNestedFilter() throws Exception {
|
public void testSortNestedWithNestedFilter() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
XContentFactory.jsonBuilder()
|
XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("grand_parent_values")
|
.startObject("grand_parent_values")
|
||||||
.field("type", "long")
|
.field("type", "long")
|
||||||
|
@ -1075,7 +1058,6 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -1448,8 +1430,7 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
|
||||||
// Issue #9305
|
// Issue #9305
|
||||||
public void testNestedSortingWithNestedFilterAsFilter() throws Exception {
|
public void testNestedSortingWithNestedFilterAsFilter() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("officelocation")
|
.startObject("officelocation")
|
||||||
|
|
|
@ -70,7 +70,6 @@ public class ExistsIT extends OpenSearchIntegTestCase {
|
||||||
public void testExists() throws Exception {
|
public void testExists() throws Exception {
|
||||||
XContentBuilder mapping = XContentBuilder.builder(JsonXContent.jsonXContent)
|
XContentBuilder mapping = XContentBuilder.builder(JsonXContent.jsonXContent)
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("foo")
|
.startObject("foo")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -95,10 +94,9 @@ public class ExistsIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
assertAcked(client().admin().indices().prepareCreate("idx").addMapping("type", mapping));
|
assertAcked(client().admin().indices().prepareCreate("idx").setMapping(mapping));
|
||||||
Map<String, Object> barObject = new HashMap<>();
|
Map<String, Object> barObject = new HashMap<>();
|
||||||
barObject.put("foo", "bar");
|
barObject.put("foo", "bar");
|
||||||
barObject.put("bar", singletonMap("bar", "foo"));
|
barObject.put("bar", singletonMap("bar", "foo"));
|
||||||
|
@ -176,7 +174,6 @@ public class ExistsIT extends OpenSearchIntegTestCase {
|
||||||
public void testFieldAlias() throws Exception {
|
public void testFieldAlias() throws Exception {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("bar")
|
.startObject("bar")
|
||||||
.field("type", "long")
|
.field("type", "long")
|
||||||
|
@ -194,9 +191,8 @@ public class ExistsIT extends OpenSearchIntegTestCase {
|
||||||
.field("path", "foo.bar")
|
.field("path", "foo.bar")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("idx").addMapping("type", mapping));
|
assertAcked(prepareCreate("idx").setMapping(mapping));
|
||||||
ensureGreen("idx");
|
ensureGreen("idx");
|
||||||
|
|
||||||
List<IndexRequestBuilder> indexRequests = new ArrayList<>();
|
List<IndexRequestBuilder> indexRequests = new ArrayList<>();
|
||||||
|
@ -226,7 +222,6 @@ public class ExistsIT extends OpenSearchIntegTestCase {
|
||||||
public void testFieldAliasWithNoDocValues() throws Exception {
|
public void testFieldAliasWithNoDocValues() throws Exception {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("foo")
|
.startObject("foo")
|
||||||
.field("type", "long")
|
.field("type", "long")
|
||||||
|
@ -237,9 +232,8 @@ public class ExistsIT extends OpenSearchIntegTestCase {
|
||||||
.field("path", "foo")
|
.field("path", "foo")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("idx").addMapping("type", mapping));
|
assertAcked(prepareCreate("idx").setMapping(mapping));
|
||||||
ensureGreen("idx");
|
ensureGreen("idx");
|
||||||
|
|
||||||
List<IndexRequestBuilder> indexRequests = new ArrayList<>();
|
List<IndexRequestBuilder> indexRequests = new ArrayList<>();
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class MultiMatchQueryIT extends OpenSearchIntegTestCase {
|
||||||
.put("index.analysis.analyzer.category.tokenizer", "standard")
|
.put("index.analysis.analyzer.category.tokenizer", "standard")
|
||||||
.put("index.analysis.analyzer.category.filter", "lowercase")
|
.put("index.analysis.analyzer.category.filter", "lowercase")
|
||||||
);
|
);
|
||||||
assertAcked(builder.addMapping("test", createMapping()));
|
assertAcked(builder.setMapping(createMapping()));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
int numDocs = scaledRandomIntBetween(50, 100);
|
int numDocs = scaledRandomIntBetween(50, 100);
|
||||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||||
|
@ -259,7 +259,6 @@ public class MultiMatchQueryIT extends OpenSearchIntegTestCase {
|
||||||
private XContentBuilder createMapping() throws IOException {
|
private XContentBuilder createMapping() throws IOException {
|
||||||
return XContentFactory.jsonBuilder()
|
return XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("test")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("id")
|
.startObject("id")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
|
@ -287,7 +286,6 @@ public class MultiMatchQueryIT extends OpenSearchIntegTestCase {
|
||||||
.field("type", "date")
|
.field("type", "date")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -278,16 +278,14 @@ public class QueryStringIT extends OpenSearchIntegTestCase {
|
||||||
public void testLimitOnExpandedFieldsButIgnoreUnmappedFields() throws Exception {
|
public void testLimitOnExpandedFieldsButIgnoreUnmappedFields() throws Exception {
|
||||||
XContentBuilder builder = jsonBuilder();
|
XContentBuilder builder = jsonBuilder();
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
builder.startObject("_doc");
|
|
||||||
builder.startObject("properties");
|
builder.startObject("properties");
|
||||||
for (int i = 0; i < CLUSTER_MAX_CLAUSE_COUNT; i++) {
|
for (int i = 0; i < CLUSTER_MAX_CLAUSE_COUNT; i++) {
|
||||||
builder.startObject("field" + i).field("type", "text").endObject();
|
builder.startObject("field" + i).field("type", "text").endObject();
|
||||||
}
|
}
|
||||||
builder.endObject(); // properties
|
builder.endObject(); // properties
|
||||||
builder.endObject(); // type1
|
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
|
|
||||||
assertAcked(prepareCreate("ignoreunmappedfields").addMapping("_doc", builder));
|
assertAcked(prepareCreate("ignoreunmappedfields").setMapping(builder));
|
||||||
|
|
||||||
client().prepareIndex("ignoreunmappedfields").setId("1").setSource("field1", "foo bar baz").get();
|
client().prepareIndex("ignoreunmappedfields").setId("1").setSource("field1", "foo bar baz").get();
|
||||||
refresh();
|
refresh();
|
||||||
|
@ -303,25 +301,19 @@ public class QueryStringIT extends OpenSearchIntegTestCase {
|
||||||
XContentBuilder builder = jsonBuilder();
|
XContentBuilder builder = jsonBuilder();
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
{
|
{
|
||||||
builder.startObject("_doc");
|
builder.startObject("properties");
|
||||||
{
|
for (int i = 0; i < CLUSTER_MAX_CLAUSE_COUNT; i++) {
|
||||||
builder.startObject("properties");
|
builder.startObject("field_A" + i).field("type", "text").endObject();
|
||||||
{
|
builder.startObject("field_B" + i).field("type", "text").endObject();
|
||||||
for (int i = 0; i < CLUSTER_MAX_CLAUSE_COUNT; i++) {
|
|
||||||
builder.startObject("field_A" + i).field("type", "text").endObject();
|
|
||||||
builder.startObject("field_B" + i).field("type", "text").endObject();
|
|
||||||
}
|
|
||||||
builder.endObject();
|
|
||||||
}
|
|
||||||
builder.endObject();
|
|
||||||
}
|
}
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
}
|
}
|
||||||
|
builder.endObject();
|
||||||
|
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("testindex").setSettings(
|
prepareCreate("testindex").setSettings(
|
||||||
Settings.builder().put(MapperService.INDEX_MAPPING_TOTAL_FIELDS_LIMIT_SETTING.getKey(), CLUSTER_MAX_CLAUSE_COUNT + 100)
|
Settings.builder().put(MapperService.INDEX_MAPPING_TOTAL_FIELDS_LIMIT_SETTING.getKey(), CLUSTER_MAX_CLAUSE_COUNT + 100)
|
||||||
).addMapping("_doc", builder)
|
).setMapping(builder)
|
||||||
);
|
);
|
||||||
|
|
||||||
client().prepareIndex("testindex").setId("1").setSource("field_A0", "foo bar baz").get();
|
client().prepareIndex("testindex").setId("1").setSource("field_A0", "foo bar baz").get();
|
||||||
|
|
|
@ -1119,10 +1119,8 @@ public class SearchQueryIT extends OpenSearchIntegTestCase {
|
||||||
public void testTermsLookupFilter() throws Exception {
|
public void testTermsLookupFilter() throws Exception {
|
||||||
assertAcked(prepareCreate("lookup").addMapping("type", "terms", "type=text", "other", "type=text"));
|
assertAcked(prepareCreate("lookup").addMapping("type", "terms", "type=text", "other", "type=text"));
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("lookup2").addMapping(
|
prepareCreate("lookup2").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("arr")
|
.startObject("arr")
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
|
@ -1133,7 +1131,6 @@ public class SearchQueryIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
assertAcked(prepareCreate("lookup3").addMapping("type", "_source", "enabled=false", "terms", "type=text"));
|
assertAcked(prepareCreate("lookup3").addMapping("type", "_source", "enabled=false", "terms", "type=text"));
|
||||||
|
@ -1600,10 +1597,8 @@ public class SearchQueryIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testSimpleDFSQuery() throws IOException {
|
public void testSimpleDFSQuery() throws IOException {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"_doc",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("_doc")
|
|
||||||
.startObject("_routing")
|
.startObject("_routing")
|
||||||
.field("required", true)
|
.field("required", true)
|
||||||
.endObject()
|
.endObject()
|
||||||
|
@ -1621,7 +1616,6 @@ public class SearchQueryIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1876,8 +1870,7 @@ public class SearchQueryIT extends OpenSearchIntegTestCase {
|
||||||
assert ("SPI,COMPAT".equals(System.getProperty("java.locale.providers"))) : "`-Djava.locale.providers=SPI,COMPAT` needs to be set";
|
assert ("SPI,COMPAT".equals(System.getProperty("java.locale.providers"))) : "`-Djava.locale.providers=SPI,COMPAT` needs to be set";
|
||||||
|
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("date_field")
|
.startObject("date_field")
|
||||||
|
@ -1978,7 +1971,6 @@ public class SearchQueryIT extends OpenSearchIntegTestCase {
|
||||||
public void testNestedQueryWithFieldAlias() throws Exception {
|
public void testNestedQueryWithFieldAlias() throws Exception {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("_doc")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("section")
|
.startObject("section")
|
||||||
.field("type", "nested")
|
.field("type", "nested")
|
||||||
|
@ -1993,9 +1985,8 @@ public class SearchQueryIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("index").addMapping("_doc", mapping));
|
assertAcked(prepareCreate("index").setMapping(mapping));
|
||||||
|
|
||||||
XContentBuilder source = XContentFactory.jsonBuilder()
|
XContentBuilder source = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
|
@ -2019,7 +2010,6 @@ public class SearchQueryIT extends OpenSearchIntegTestCase {
|
||||||
public void testFieldAliasesForMetaFields() throws Exception {
|
public void testFieldAliasesForMetaFields() throws Exception {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("id-alias")
|
.startObject("id-alias")
|
||||||
.field("type", "alias")
|
.field("type", "alias")
|
||||||
|
@ -2030,9 +2020,8 @@ public class SearchQueryIT extends OpenSearchIntegTestCase {
|
||||||
.field("path", "_routing")
|
.field("path", "_routing")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("type", mapping));
|
assertAcked(prepareCreate("test").setMapping(mapping));
|
||||||
|
|
||||||
IndexRequestBuilder indexRequest = client().prepareIndex("test").setId("1").setRouting("custom").setSource("field", "value");
|
IndexRequestBuilder indexRequest = client().prepareIndex("test").setId("1").setRouting("custom").setSource("field", "value");
|
||||||
indexRandom(true, false, indexRequest);
|
indexRandom(true, false, indexRequest);
|
||||||
|
|
|
@ -239,10 +239,8 @@ public class SimpleQueryStringIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testNestedFieldSimpleQueryString() throws IOException {
|
public void testNestedFieldSimpleQueryString() throws IOException {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("body")
|
.startObject("body")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -253,7 +251,6 @@ public class SimpleQueryStringIT extends OpenSearchIntegTestCase {
|
||||||
.endObject() // fields
|
.endObject() // fields
|
||||||
.endObject() // body
|
.endObject() // body
|
||||||
.endObject() // properties
|
.endObject() // properties
|
||||||
.endObject() // type1
|
|
||||||
.endObject()
|
.endObject()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -607,19 +604,17 @@ public class SimpleQueryStringIT extends OpenSearchIntegTestCase {
|
||||||
public void testLimitOnExpandedFields() throws Exception {
|
public void testLimitOnExpandedFields() throws Exception {
|
||||||
XContentBuilder builder = jsonBuilder();
|
XContentBuilder builder = jsonBuilder();
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
builder.startObject("type1");
|
|
||||||
builder.startObject("properties");
|
builder.startObject("properties");
|
||||||
for (int i = 0; i < CLUSTER_MAX_CLAUSE_COUNT + 1; i++) {
|
for (int i = 0; i < CLUSTER_MAX_CLAUSE_COUNT + 1; i++) {
|
||||||
builder.startObject("field" + i).field("type", "text").endObject();
|
builder.startObject("field" + i).field("type", "text").endObject();
|
||||||
}
|
}
|
||||||
builder.endObject(); // properties
|
builder.endObject(); // properties
|
||||||
builder.endObject(); // type1
|
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
|
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("toomanyfields").setSettings(
|
prepareCreate("toomanyfields").setSettings(
|
||||||
Settings.builder().put(MapperService.INDEX_MAPPING_TOTAL_FIELDS_LIMIT_SETTING.getKey(), CLUSTER_MAX_CLAUSE_COUNT + 100)
|
Settings.builder().put(MapperService.INDEX_MAPPING_TOTAL_FIELDS_LIMIT_SETTING.getKey(), CLUSTER_MAX_CLAUSE_COUNT + 100)
|
||||||
).addMapping("type1", builder)
|
).setMapping(builder)
|
||||||
);
|
);
|
||||||
|
|
||||||
client().prepareIndex("toomanyfields").setId("1").setSource("field1", "foo bar baz").get();
|
client().prepareIndex("toomanyfields").setId("1").setSource("field1", "foo bar baz").get();
|
||||||
|
|
|
@ -127,11 +127,7 @@ public class ScriptQuerySearchIT extends OpenSearchIntegTestCase {
|
||||||
final byte[] randomBytesDoc2 = getRandomBytes(16);
|
final byte[] randomBytesDoc2 = getRandomBytes(16);
|
||||||
|
|
||||||
assertAcked(
|
assertAcked(
|
||||||
client().admin()
|
client().admin().indices().prepareCreate("my-index").setMapping(createMappingSource("binary")).setSettings(indexSettings())
|
||||||
.indices()
|
|
||||||
.prepareCreate("my-index")
|
|
||||||
.addMapping("my-type", createMappingSource("binary"))
|
|
||||||
.setSettings(indexSettings())
|
|
||||||
);
|
);
|
||||||
client().prepareIndex("my-index")
|
client().prepareIndex("my-index")
|
||||||
.setId("1")
|
.setId("1")
|
||||||
|
@ -170,14 +166,12 @@ public class ScriptQuerySearchIT extends OpenSearchIntegTestCase {
|
||||||
private XContentBuilder createMappingSource(String fieldType) throws IOException {
|
private XContentBuilder createMappingSource(String fieldType) throws IOException {
|
||||||
return XContentFactory.jsonBuilder()
|
return XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("my-type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("binaryData")
|
.startObject("binaryData")
|
||||||
.field("type", fieldType)
|
.field("type", fieldType)
|
||||||
.field("doc_values", "true")
|
.field("doc_values", "true")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,10 +115,8 @@ public class DuelScrollIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
private TestContext create(SearchType... searchTypes) throws Exception {
|
private TestContext create(SearchType... searchTypes) throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("index").addMapping(
|
prepareCreate("index").setMapping(
|
||||||
"type",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "long")
|
.field("type", "long")
|
||||||
|
@ -139,7 +137,6 @@ public class DuelScrollIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -276,11 +276,9 @@ public class FieldSortIT extends OpenSearchIntegTestCase {
|
||||||
public void testRandomSorting() throws IOException, InterruptedException, ExecutionException {
|
public void testRandomSorting() throws IOException, InterruptedException, ExecutionException {
|
||||||
Random random = random();
|
Random random = random();
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type",
|
|
||||||
XContentFactory.jsonBuilder()
|
XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("sparse_bytes")
|
.startObject("sparse_bytes")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
|
@ -290,7 +288,6 @@ public class FieldSortIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -558,11 +555,9 @@ public class FieldSortIT extends OpenSearchIntegTestCase {
|
||||||
public void testSimpleSorts() throws Exception {
|
public void testSimpleSorts() throws Exception {
|
||||||
Random random = random();
|
Random random = random();
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
XContentFactory.jsonBuilder()
|
XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("str_value")
|
.startObject("str_value")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
|
@ -590,7 +585,6 @@ public class FieldSortIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -801,11 +795,9 @@ public class FieldSortIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testSortMissingNumbers() throws Exception {
|
public void testSortMissingNumbers() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
XContentFactory.jsonBuilder()
|
XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("i_value")
|
.startObject("i_value")
|
||||||
.field("type", "integer")
|
.field("type", "integer")
|
||||||
|
@ -815,7 +807,6 @@ public class FieldSortIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -873,18 +864,15 @@ public class FieldSortIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testSortMissingStrings() throws IOException {
|
public void testSortMissingStrings() throws IOException {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
XContentFactory.jsonBuilder()
|
XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("value")
|
.startObject("value")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -1009,11 +997,9 @@ public class FieldSortIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testSortMVField() throws Exception {
|
public void testSortMVField() throws Exception {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
XContentFactory.jsonBuilder()
|
XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("long_values")
|
.startObject("long_values")
|
||||||
.field("type", "long")
|
.field("type", "long")
|
||||||
|
@ -1038,7 +1024,6 @@ public class FieldSortIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -1345,18 +1330,15 @@ public class FieldSortIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testSortOnRareField() throws IOException {
|
public void testSortOnRareField() throws IOException {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
XContentFactory.jsonBuilder()
|
XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("string_values")
|
.startObject("string_values")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -1494,11 +1476,9 @@ public class FieldSortIT extends OpenSearchIntegTestCase {
|
||||||
*/
|
*/
|
||||||
public void testNestedSort() throws IOException, InterruptedException, ExecutionException {
|
public void testNestedSort() throws IOException, InterruptedException, ExecutionException {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type",
|
|
||||||
XContentFactory.jsonBuilder()
|
XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("nested")
|
.startObject("nested")
|
||||||
.field("type", "nested")
|
.field("type", "nested")
|
||||||
|
@ -1530,7 +1510,6 @@ public class FieldSortIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
|
@ -72,12 +72,11 @@ public class GeoDistanceIT extends OpenSearchIntegTestCase {
|
||||||
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
||||||
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("locations")
|
.startObject("locations")
|
||||||
.field("type", "geo_point");
|
.field("type", "geo_point");
|
||||||
xContentBuilder.field("ignore_malformed", true).endObject().endObject().endObject().endObject();
|
xContentBuilder.field("ignore_malformed", true).endObject().endObject().endObject();
|
||||||
assertAcked(prepareCreate("test").setSettings(settings).addMapping("type1", xContentBuilder));
|
assertAcked(prepareCreate("test").setSettings(settings).setMapping(xContentBuilder));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
|
@ -268,12 +267,11 @@ public class GeoDistanceIT extends OpenSearchIntegTestCase {
|
||||||
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
||||||
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("locations")
|
.startObject("locations")
|
||||||
.field("type", "geo_point");
|
.field("type", "geo_point");
|
||||||
xContentBuilder.endObject().endObject().endObject().endObject();
|
xContentBuilder.endObject().endObject().endObject();
|
||||||
assertAcked(prepareCreate("test").setSettings(settings).addMapping("type1", xContentBuilder));
|
assertAcked(prepareCreate("test").setSettings(settings).setMapping(xContentBuilder));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex("test")
|
client().prepareIndex("test")
|
||||||
|
@ -333,7 +331,6 @@ public class GeoDistanceIT extends OpenSearchIntegTestCase {
|
||||||
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, version).build();
|
||||||
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("company")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("name")
|
.startObject("name")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -346,9 +343,9 @@ public class GeoDistanceIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.startObject("location")
|
.startObject("location")
|
||||||
.field("type", "geo_point");
|
.field("type", "geo_point");
|
||||||
xContentBuilder.endObject().endObject().endObject().endObject().endObject().endObject();
|
xContentBuilder.endObject().endObject().endObject().endObject().endObject();
|
||||||
|
|
||||||
assertAcked(prepareCreate("companies").setSettings(settings).addMapping("company", xContentBuilder));
|
assertAcked(prepareCreate("companies").setSettings(settings).setMapping(xContentBuilder));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
indexRandom(
|
indexRandom(
|
||||||
|
@ -590,15 +587,14 @@ public class GeoDistanceIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
XContentBuilder mapping = JsonXContent.contentBuilder()
|
XContentBuilder mapping = JsonXContent.contentBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("location")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("pin")
|
.startObject("pin")
|
||||||
.field("type", "geo_point");
|
.field("type", "geo_point");
|
||||||
mapping.endObject().endObject().endObject().endObject();
|
mapping.endObject().endObject().endObject();
|
||||||
|
|
||||||
XContentBuilder source = JsonXContent.contentBuilder().startObject().field("pin", Geohash.stringEncode(lon, lat)).endObject();
|
XContentBuilder source = JsonXContent.contentBuilder().startObject().field("pin", Geohash.stringEncode(lon, lat)).endObject();
|
||||||
|
|
||||||
assertAcked(prepareCreate("locations").setSettings(settings).addMapping("location", mapping));
|
assertAcked(prepareCreate("locations").setSettings(settings).setMapping(mapping));
|
||||||
client().prepareIndex("locations").setId("1").setCreate(true).setSource(source).get();
|
client().prepareIndex("locations").setId("1").setCreate(true).setSource(source).get();
|
||||||
refresh();
|
refresh();
|
||||||
client().prepareGet("locations", "1").get();
|
client().prepareGet("locations", "1").get();
|
||||||
|
@ -614,12 +610,11 @@ public class GeoDistanceIT extends OpenSearchIntegTestCase {
|
||||||
public void testDistanceSortingWithUnmappedField() throws Exception {
|
public void testDistanceSortingWithUnmappedField() throws Exception {
|
||||||
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("locations")
|
.startObject("locations")
|
||||||
.field("type", "geo_point");
|
.field("type", "geo_point");
|
||||||
xContentBuilder.endObject().endObject().endObject().endObject();
|
xContentBuilder.endObject().endObject().endObject();
|
||||||
assertAcked(prepareCreate("test1").addMapping("type1", xContentBuilder));
|
assertAcked(prepareCreate("test1").setMapping(xContentBuilder));
|
||||||
assertAcked(prepareCreate("test2"));
|
assertAcked(prepareCreate("test2"));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
|
|
|
@ -134,10 +134,8 @@ public class SimpleSortIT extends OpenSearchIntegTestCase {
|
||||||
public void testSimpleSorts() throws Exception {
|
public void testSimpleSorts() throws Exception {
|
||||||
Random random = random();
|
Random random = random();
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("str_value")
|
.startObject("str_value")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
|
@ -165,7 +163,6 @@ public class SimpleSortIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -446,17 +443,14 @@ public class SimpleSortIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void test2920() throws IOException {
|
public void test2920() throws IOException {
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").addMapping(
|
prepareCreate("test").setMapping(
|
||||||
"test",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("test")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("value")
|
.startObject("value")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
|
@ -682,15 +682,13 @@ public class CompletionSuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
public void testThatUpgradeToMultiFieldsWorks() throws Exception {
|
public void testThatUpgradeToMultiFieldsWorks() throws Exception {
|
||||||
final XContentBuilder mapping = jsonBuilder().startObject()
|
final XContentBuilder mapping = jsonBuilder().startObject()
|
||||||
.startObject(MapperService.SINGLE_MAPPING_NAME)
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject(FIELD)
|
.startObject(FIELD)
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate(INDEX).addMapping(MapperService.SINGLE_MAPPING_NAME, mapping));
|
assertAcked(prepareCreate(INDEX).setMapping(mapping));
|
||||||
client().prepareIndex(INDEX)
|
client().prepareIndex(INDEX)
|
||||||
.setId("1")
|
.setId("1")
|
||||||
.setRefreshPolicy(IMMEDIATE)
|
.setRefreshPolicy(IMMEDIATE)
|
||||||
|
@ -1328,7 +1326,7 @@ public class CompletionSuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate(INDEX)
|
.prepareCreate(INDEX)
|
||||||
.setSettings(Settings.builder().put(indexSettings()).put(settings))
|
.setSettings(Settings.builder().put(indexSettings()).put(settings))
|
||||||
.addMapping(MapperService.SINGLE_MAPPING_NAME, mapping)
|
.setMapping(mapping)
|
||||||
.get()
|
.get()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1376,17 +1374,14 @@ public class CompletionSuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
client().admin()
|
client().admin()
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate(INDEX)
|
.prepareCreate(INDEX)
|
||||||
.addMapping(
|
.setMapping(
|
||||||
MapperService.SINGLE_MAPPING_NAME,
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject(MapperService.SINGLE_MAPPING_NAME)
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject(FIELD)
|
.startObject(FIELD)
|
||||||
.field("type", "completion")
|
.field("type", "completion")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
.get()
|
.get()
|
||||||
);
|
);
|
||||||
|
@ -1408,17 +1403,14 @@ public class CompletionSuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
client().admin()
|
client().admin()
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate(INDEX)
|
.prepareCreate(INDEX)
|
||||||
.addMapping(
|
.setMapping(
|
||||||
MapperService.SINGLE_MAPPING_NAME,
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject(MapperService.SINGLE_MAPPING_NAME)
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject(FIELD)
|
.startObject(FIELD)
|
||||||
.field("type", "completion")
|
.field("type", "completion")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
.get()
|
.get()
|
||||||
);
|
);
|
||||||
|
@ -1449,17 +1441,14 @@ public class CompletionSuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
client().admin()
|
client().admin()
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate(INDEX)
|
.prepareCreate(INDEX)
|
||||||
.addMapping(
|
.setMapping(
|
||||||
MapperService.SINGLE_MAPPING_NAME,
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject(MapperService.SINGLE_MAPPING_NAME)
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject(FIELD)
|
.startObject(FIELD)
|
||||||
.field("type", "completion")
|
.field("type", "completion")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
.get()
|
.get()
|
||||||
);
|
);
|
||||||
|
@ -1508,7 +1497,6 @@ public class CompletionSuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
public void testSuggestWithFieldAlias() throws Exception {
|
public void testSuggestWithFieldAlias() throws Exception {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject(MapperService.SINGLE_MAPPING_NAME)
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject(FIELD)
|
.startObject(FIELD)
|
||||||
.field("type", "completion")
|
.field("type", "completion")
|
||||||
|
@ -1518,9 +1506,8 @@ public class CompletionSuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
.field("path", FIELD)
|
.field("path", FIELD)
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate(INDEX).addMapping(MapperService.SINGLE_MAPPING_NAME, mapping));
|
assertAcked(prepareCreate(INDEX).setMapping(mapping));
|
||||||
|
|
||||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||||
builders.add(client().prepareIndex(INDEX).setSource(FIELD, "apple"));
|
builders.add(client().prepareIndex(INDEX).setSource(FIELD, "apple"));
|
||||||
|
|
|
@ -42,7 +42,6 @@ import org.opensearch.common.settings.Settings;
|
||||||
import org.opensearch.common.unit.Fuzziness;
|
import org.opensearch.common.unit.Fuzziness;
|
||||||
import org.opensearch.common.xcontent.ToXContent;
|
import org.opensearch.common.xcontent.ToXContent;
|
||||||
import org.opensearch.common.xcontent.XContentBuilder;
|
import org.opensearch.common.xcontent.XContentBuilder;
|
||||||
import org.opensearch.index.mapper.MapperService;
|
|
||||||
import org.opensearch.rest.RestStatus;
|
import org.opensearch.rest.RestStatus;
|
||||||
import org.opensearch.search.suggest.CompletionSuggestSearchIT.CompletionMappingBuilder;
|
import org.opensearch.search.suggest.CompletionSuggestSearchIT.CompletionMappingBuilder;
|
||||||
import org.opensearch.search.suggest.completion.CompletionSuggestionBuilder;
|
import org.opensearch.search.suggest.completion.CompletionSuggestionBuilder;
|
||||||
|
@ -608,7 +607,7 @@ public class ContextCompletionSuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
mapping.endObject();
|
mapping.endObject();
|
||||||
mapping.endObject();
|
mapping.endObject();
|
||||||
|
|
||||||
assertAcked(prepareCreate(INDEX).addMapping(MapperService.SINGLE_MAPPING_NAME, mapping));
|
assertAcked(prepareCreate(INDEX).setMapping(mapping));
|
||||||
|
|
||||||
XContentBuilder source1 = jsonBuilder().startObject()
|
XContentBuilder source1 = jsonBuilder().startObject()
|
||||||
.startObject("location")
|
.startObject("location")
|
||||||
|
@ -754,7 +753,7 @@ public class ContextCompletionSuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate(INDEX)
|
.prepareCreate(INDEX)
|
||||||
.setSettings(Settings.builder().put(indexSettings()).put(settings))
|
.setSettings(Settings.builder().put(indexSettings()).put(settings))
|
||||||
.addMapping(MapperService.SINGLE_MAPPING_NAME, mapping)
|
.setMapping(mapping)
|
||||||
.get()
|
.get()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,16 +127,14 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("text")
|
.startObject("text")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("analyzer", "keyword")
|
.field("analyzer", "keyword")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test_2").addMapping("type1", mapping));
|
assertAcked(prepareCreate("test_2").setMapping(mapping));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
index("test_2", "type1", "1", "text", "ab cd");
|
index("test_2", "type1", "1", "text", "ab cd");
|
||||||
|
@ -217,7 +215,6 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("name")
|
.startObject("name")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -230,9 +227,8 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(builder.addMapping("type1", mapping));
|
assertAcked(builder.setMapping(mapping));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
index("test", "type1", "1", "name", "I like iced tea");
|
index("test", "type1", "1", "name", "I like iced tea");
|
||||||
|
@ -300,7 +296,6 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
);
|
);
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("name")
|
.startObject("name")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -313,9 +308,8 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(builder.addMapping("type1", mapping));
|
assertAcked(builder.setMapping(mapping));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
indexRandom(
|
indexRandom(
|
||||||
|
@ -558,7 +552,6 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
);
|
);
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("body")
|
.startObject("body")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -569,9 +562,8 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
.field("analyzer", "bigram")
|
.field("analyzer", "bigram")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(builder.addMapping("type1", mapping));
|
assertAcked(builder.setMapping(mapping));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
index("test", "type1", "1", "body", "hello world");
|
index("test", "type1", "1", "body", "hello world");
|
||||||
|
@ -614,7 +606,6 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
);
|
);
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("body")
|
.startObject("body")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -625,9 +616,8 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
.field("analyzer", "bigram")
|
.field("analyzer", "bigram")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(builder.addMapping("type1", mapping));
|
assertAcked(builder.setMapping(mapping));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
String[] strings = new String[] {
|
String[] strings = new String[] {
|
||||||
|
@ -758,7 +748,6 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("body")
|
.startObject("body")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -769,9 +758,8 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
.field("analyzer", "bigram")
|
.field("analyzer", "bigram")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(builder.addMapping("type1", mapping));
|
assertAcked(builder.setMapping(mapping));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
String line = "xorr the god jewel";
|
String line = "xorr the god jewel";
|
||||||
|
@ -833,16 +821,14 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type2")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("name")
|
.startObject("name")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("analyzer", "suggest")
|
.field("analyzer", "suggest")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(builder.addMapping("type2", mapping));
|
assertAcked(builder.setMapping(mapping));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
index("test", "type2", "1", "foo", "bar");
|
index("test", "type2", "1", "foo", "bar");
|
||||||
|
@ -880,14 +866,12 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
public void testEmptyShards() throws IOException, InterruptedException {
|
public void testEmptyShards() throws IOException, InterruptedException {
|
||||||
XContentBuilder mappingBuilder = XContentFactory.jsonBuilder()
|
XContentBuilder mappingBuilder = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("name")
|
.startObject("name")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("analyzer", "suggest")
|
.field("analyzer", "suggest")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(
|
assertAcked(
|
||||||
prepareCreate("test").setSettings(
|
prepareCreate("test").setSettings(
|
||||||
|
@ -901,7 +885,7 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
.put("index.analysis.filter.shingler.min_shingle_size", 2)
|
.put("index.analysis.filter.shingler.min_shingle_size", 2)
|
||||||
.put("index.analysis.filter.shingler.max_shingle_size", 5)
|
.put("index.analysis.filter.shingler.max_shingle_size", 5)
|
||||||
.put("index.analysis.filter.shingler.output_unigrams", true)
|
.put("index.analysis.filter.shingler.output_unigrams", true)
|
||||||
).addMapping("type1", mappingBuilder)
|
).setMapping(mappingBuilder)
|
||||||
);
|
);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
|
@ -978,16 +962,14 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("body")
|
.startObject("body")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("analyzer", "body")
|
.field("analyzer", "body")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(builder.addMapping("type1", mapping));
|
assertAcked(builder.setMapping(mapping));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
NumShards test = getNumShards("test");
|
NumShards test = getNumShards("test");
|
||||||
|
@ -1039,16 +1021,14 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("title")
|
.startObject("title")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("analyzer", "text")
|
.field("analyzer", "text")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(builder.addMapping("type1", mapping));
|
assertAcked(builder.setMapping(mapping));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
List<String> titles = new ArrayList<>();
|
List<String> titles = new ArrayList<>();
|
||||||
|
@ -1166,7 +1146,6 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
public void testSuggestWithFieldAlias() throws Exception {
|
public void testSuggestWithFieldAlias() throws Exception {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("text")
|
.startObject("text")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
|
@ -1176,9 +1155,8 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
.field("path", "text")
|
.field("path", "text")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(prepareCreate("test").addMapping("type", mapping));
|
assertAcked(prepareCreate("test").setMapping(mapping));
|
||||||
|
|
||||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||||
builders.add(client().prepareIndex("test").setSource("text", "apple"));
|
builders.add(client().prepareIndex("test").setSource("text", "apple"));
|
||||||
|
@ -1195,17 +1173,13 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
public void testPhraseSuggestMinDocFreq() throws Exception {
|
public void testPhraseSuggestMinDocFreq() throws Exception {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("text")
|
.startObject("text")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(
|
assertAcked(prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 1).build()).setMapping(mapping));
|
||||||
prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 1).build()).addMapping("type", mapping)
|
|
||||||
);
|
|
||||||
|
|
||||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||||
builders.add(client().prepareIndex("test").setSource("text", "apple"));
|
builders.add(client().prepareIndex("test").setSource("text", "apple"));
|
||||||
|
@ -1298,16 +1272,14 @@ public class SuggestSearchIT extends OpenSearchIntegTestCase {
|
||||||
|
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("title")
|
.startObject("title")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("analyzer", "text")
|
.field("analyzer", "text")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(builder.addMapping("type1", mapping));
|
assertAcked(builder.setMapping(mapping));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
List<String> titles = new ArrayList<>();
|
List<String> titles = new ArrayList<>();
|
||||||
|
|
|
@ -53,10 +53,8 @@ public class SimilarityIT extends OpenSearchIntegTestCase {
|
||||||
client().admin()
|
client().admin()
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate("test")
|
.prepareCreate("test")
|
||||||
.addMapping(
|
.setMapping(
|
||||||
"type1",
|
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("similarity", "custom")
|
.field("similarity", "custom")
|
||||||
|
@ -68,7 +66,6 @@ public class SimilarityIT extends OpenSearchIntegTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
)
|
)
|
||||||
.setSettings(
|
.setSettings(
|
||||||
Settings.builder()
|
Settings.builder()
|
||||||
|
|
|
@ -248,16 +248,33 @@ public class CreateIndexRequest extends AcknowledgedRequest<CreateIndexRequest>
|
||||||
/**
|
/**
|
||||||
* Adds mapping that will be added when the index gets created.
|
* Adds mapping that will be added when the index gets created.
|
||||||
*
|
*
|
||||||
* @param type The mapping type
|
|
||||||
* @param source The mapping source
|
* @param source The mapping source
|
||||||
* @param xContentType the content type of the mapping source
|
* @param xContentType the content type of the mapping source
|
||||||
* @deprecated types are being removed
|
* @deprecated types are being removed
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private CreateIndexRequest mapping(String type, BytesReference source, XContentType xContentType) {
|
private CreateIndexRequest mapping(BytesReference source, XContentType xContentType) {
|
||||||
Objects.requireNonNull(xContentType);
|
Objects.requireNonNull(xContentType);
|
||||||
Map<String, Object> mappingAsMap = XContentHelper.convertToMap(source, false, xContentType).v2();
|
Map<String, Object> mappingAsMap = XContentHelper.convertToMap(source, false, xContentType).v2();
|
||||||
return mapping(type, mappingAsMap);
|
return mapping(MapperService.SINGLE_MAPPING_NAME, mappingAsMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds mapping that will be added when the index gets created.
|
||||||
|
*
|
||||||
|
* @param source The mapping source
|
||||||
|
*/
|
||||||
|
public CreateIndexRequest mapping(XContentBuilder source) {
|
||||||
|
return mapping(BytesReference.bytes(source), source.contentType());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the mapping for this index
|
||||||
|
*
|
||||||
|
* @param source The mapping source
|
||||||
|
*/
|
||||||
|
public CreateIndexRequest mapping(Map<String, ?> source) {
|
||||||
|
return mapping(MapperService.SINGLE_MAPPING_NAME, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -268,19 +285,7 @@ public class CreateIndexRequest extends AcknowledgedRequest<CreateIndexRequest>
|
||||||
* @deprecated types are being removed
|
* @deprecated types are being removed
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public CreateIndexRequest mapping(String type, XContentBuilder source) {
|
private CreateIndexRequest mapping(String type, Map<String, ?> source) {
|
||||||
return mapping(type, BytesReference.bytes(source), source.contentType());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds mapping that will be added when the index gets created.
|
|
||||||
*
|
|
||||||
* @param type The mapping type
|
|
||||||
* @param source The mapping source
|
|
||||||
* @deprecated types are being removed
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public CreateIndexRequest mapping(String type, Map<String, ?> source) {
|
|
||||||
// wrap it in a type map if its not
|
// wrap it in a type map if its not
|
||||||
if (source.size() != 1 || !source.containsKey(type)) {
|
if (source.size() != 1 || !source.containsKey(type)) {
|
||||||
source = Collections.singletonMap(MapperService.SINGLE_MAPPING_NAME, source);
|
source = Collections.singletonMap(MapperService.SINGLE_MAPPING_NAME, source);
|
||||||
|
@ -304,7 +309,7 @@ public class CreateIndexRequest extends AcknowledgedRequest<CreateIndexRequest>
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public CreateIndexRequest mapping(String type, Object... source) {
|
public CreateIndexRequest mapping(String type, Object... source) {
|
||||||
mapping(type, PutMappingRequest.buildFromSimplifiedDef(source));
|
mapping(PutMappingRequest.buildFromSimplifiedDef(source));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,43 +113,28 @@ public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<
|
||||||
*
|
*
|
||||||
* @param source The mapping source
|
* @param source The mapping source
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public CreateIndexRequestBuilder setMapping(String source) {
|
public CreateIndexRequestBuilder setMapping(String source) {
|
||||||
request.mapping(source);
|
request.mapping(source);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The cause for this index creation.
|
* Adds mapping that will be added when the index gets created.
|
||||||
|
*
|
||||||
|
* @param source The mapping source
|
||||||
*/
|
*/
|
||||||
public CreateIndexRequestBuilder setCause(String cause) {
|
public CreateIndexRequestBuilder setMapping(XContentBuilder source) {
|
||||||
request.cause(cause);
|
request.mapping(source);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds mapping that will be added when the index gets created.
|
* Adds mapping that will be added when the index gets created.
|
||||||
*
|
*
|
||||||
* @param type The mapping type
|
|
||||||
* @param source The mapping source
|
* @param source The mapping source
|
||||||
* @deprecated types are being removed
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
public CreateIndexRequestBuilder setMapping(Map<String, Object> source) {
|
||||||
public CreateIndexRequestBuilder addMapping(String type, XContentBuilder source) {
|
request.mapping(source);
|
||||||
request.mapping(type, source);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds mapping that will be added when the index gets created.
|
|
||||||
*
|
|
||||||
* @param type The mapping type
|
|
||||||
* @param source The mapping source
|
|
||||||
* @deprecated types are being removed
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public CreateIndexRequestBuilder addMapping(String type, Map<String, Object> source) {
|
|
||||||
request.mapping(type, source);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,6 +149,14 @@ public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The cause for this index creation.
|
||||||
|
*/
|
||||||
|
public CreateIndexRequestBuilder setCause(String cause) {
|
||||||
|
request.cause(cause);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the aliases that will be associated with the index when it gets created
|
* Sets the aliases that will be associated with the index when it gets created
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class RolloverRequest extends AcknowledgedRequest<RolloverRequest> implem
|
||||||
if (MapperService.isMappingSourceTyped(MapperService.SINGLE_MAPPING_NAME, mappings)) {
|
if (MapperService.isMappingSourceTyped(MapperService.SINGLE_MAPPING_NAME, mappings)) {
|
||||||
throw new IllegalArgumentException("The mapping definition cannot be nested under a type");
|
throw new IllegalArgumentException("The mapping definition cannot be nested under a type");
|
||||||
}
|
}
|
||||||
request.createIndexRequest.mapping(MapperService.SINGLE_MAPPING_NAME, mappings);
|
request.createIndexRequest.mapping(mappings);
|
||||||
}, CreateIndexRequest.MAPPINGS, ObjectParser.ValueType.OBJECT);
|
}, CreateIndexRequest.MAPPINGS, ObjectParser.ValueType.OBJECT);
|
||||||
PARSER.declareField(
|
PARSER.declareField(
|
||||||
(parser, request, context) -> request.createIndexRequest.aliases(parser.map()),
|
(parser, request, context) -> request.createIndexRequest.aliases(parser.map()),
|
||||||
|
|
|
@ -116,10 +116,10 @@ public class CreateIndexRequestTests extends OpenSearchTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
request1.mapping("type1", builder);
|
request1.mapping(builder);
|
||||||
builder = XContentFactory.contentBuilder(randomFrom(XContentType.values()));
|
builder = XContentFactory.contentBuilder(randomFrom(XContentType.values()));
|
||||||
builder.startObject()
|
builder.startObject()
|
||||||
.startObject("type1")
|
.startObject(MapperService.SINGLE_MAPPING_NAME)
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -134,7 +134,7 @@ public class CreateIndexRequestTests extends OpenSearchTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
request2.mapping("type1", builder);
|
request2.mapping(builder);
|
||||||
assertEquals(request1.mappings(), request2.mappings());
|
assertEquals(request1.mappings(), request2.mappings());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class PutMappingRequestTests extends OpenSearchTestCase {
|
||||||
String index = randomAlphaOfLength(5);
|
String index = randomAlphaOfLength(5);
|
||||||
|
|
||||||
PutMappingRequest request = new PutMappingRequest(index);
|
PutMappingRequest request = new PutMappingRequest(index);
|
||||||
request.source(RandomCreateIndexGenerator.randomMapping("_doc"));
|
request.source(RandomCreateIndexGenerator.randomMapping());
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,8 +218,7 @@ public class RolloverRequestTests extends OpenSearchTestCase {
|
||||||
private static RolloverRequest createTestItem() throws IOException {
|
private static RolloverRequest createTestItem() throws IOException {
|
||||||
RolloverRequest rolloverRequest = new RolloverRequest();
|
RolloverRequest rolloverRequest = new RolloverRequest();
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
rolloverRequest.getCreateIndexRequest()
|
rolloverRequest.getCreateIndexRequest().mapping(RandomCreateIndexGenerator.randomMapping());
|
||||||
.mapping(MapperService.SINGLE_MAPPING_NAME, RandomCreateIndexGenerator.randomMapping(MapperService.SINGLE_MAPPING_NAME));
|
|
||||||
}
|
}
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
RandomCreateIndexGenerator.randomAliases(rolloverRequest.getCreateIndexRequest());
|
RandomCreateIndexGenerator.randomAliases(rolloverRequest.getCreateIndexRequest());
|
||||||
|
|
|
@ -67,7 +67,6 @@ public class IndicesStatsTests extends OpenSearchSingleNodeTestCase {
|
||||||
IndexModule.Type storeType = IndexModule.defaultStoreType(true);
|
IndexModule.Type storeType = IndexModule.defaultStoreType(true);
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("doc")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("foo")
|
.startObject("foo")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
|
@ -82,13 +81,12 @@ public class IndicesStatsTests extends OpenSearchSingleNodeTestCase {
|
||||||
.field("type", "long")
|
.field("type", "long")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
assertAcked(
|
assertAcked(
|
||||||
client().admin()
|
client().admin()
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate("test")
|
.prepareCreate("test")
|
||||||
.addMapping("doc", mapping)
|
.setMapping(mapping)
|
||||||
.setSettings(Settings.builder().put("index.store.type", storeType.getSettingsKey()))
|
.setSettings(Settings.builder().put("index.store.type", storeType.getSettingsKey()))
|
||||||
);
|
);
|
||||||
ensureGreen("test");
|
ensureGreen("test");
|
||||||
|
|
|
@ -219,16 +219,16 @@ public abstract class AbstractTermVectorsTestCase extends OpenSearchIntegTestCas
|
||||||
|
|
||||||
protected void createIndexBasedOnFieldSettings(String index, String alias, TestFieldSetting[] fieldSettings) throws IOException {
|
protected void createIndexBasedOnFieldSettings(String index, String alias, TestFieldSetting[] fieldSettings) throws IOException {
|
||||||
XContentBuilder mappingBuilder = jsonBuilder();
|
XContentBuilder mappingBuilder = jsonBuilder();
|
||||||
mappingBuilder.startObject().startObject("type1").startObject("properties");
|
mappingBuilder.startObject().startObject("properties");
|
||||||
for (TestFieldSetting field : fieldSettings) {
|
for (TestFieldSetting field : fieldSettings) {
|
||||||
field.addToMappings(mappingBuilder);
|
field.addToMappings(mappingBuilder);
|
||||||
}
|
}
|
||||||
mappingBuilder.endObject().endObject().endObject();
|
mappingBuilder.endObject().endObject();
|
||||||
Settings.Builder settings = Settings.builder()
|
Settings.Builder settings = Settings.builder()
|
||||||
.put(indexSettings())
|
.put(indexSettings())
|
||||||
.put("index.analysis.analyzer.tv_test.tokenizer", "standard")
|
.put("index.analysis.analyzer.tv_test.tokenizer", "standard")
|
||||||
.putList("index.analysis.analyzer.tv_test.filter", "lowercase");
|
.putList("index.analysis.analyzer.tv_test.filter", "lowercase");
|
||||||
assertAcked(prepareCreate(index).addMapping("type1", mappingBuilder).setSettings(settings).addAlias(new Alias(alias)));
|
assertAcked(prepareCreate(index).setMapping(mappingBuilder).setSettings(settings).addAlias(new Alias(alias)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -169,7 +169,6 @@ public class GetTermVectorsTests extends OpenSearchSingleNodeTestCase {
|
||||||
String queryString = createString(tokens, payloads, encoding, delimiter.charAt(0));
|
String queryString = createString(tokens, payloads, encoding, delimiter.charAt(0));
|
||||||
// create the mapping
|
// create the mapping
|
||||||
XContentBuilder mapping = jsonBuilder().startObject()
|
XContentBuilder mapping = jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field")
|
.startObject("field")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -177,7 +176,6 @@ public class GetTermVectorsTests extends OpenSearchSingleNodeTestCase {
|
||||||
.field("analyzer", "payload_test")
|
.field("analyzer", "payload_test")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
Settings setting = Settings.builder()
|
Settings setting = Settings.builder()
|
||||||
.put("index.analysis.analyzer.payload_test.tokenizer", "mock-whitespace")
|
.put("index.analysis.analyzer.payload_test.tokenizer", "mock-whitespace")
|
||||||
|
|
|
@ -114,14 +114,12 @@ public class PreBuiltAnalyzerTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field")
|
.startObject("field")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("analyzer", analyzerName)
|
.field("analyzer", analyzerName)
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
MapperService mapperService = createIndex("test", indexSettings, "type", mapping).mapperService();
|
MapperService mapperService = createIndex("test", indexSettings, "type", mapping).mapperService();
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class FieldFilterMapperPluginTests extends OpenSearchSingleNodeTestCase {
|
||||||
// as the one coming from a filtered index with same mappings
|
// as the one coming from a filtered index with same mappings
|
||||||
GetMappingsResponse getMappingsResponse = client().admin().indices().prepareGetMappings("filtered").get();
|
GetMappingsResponse getMappingsResponse = client().admin().indices().prepareGetMappings("filtered").get();
|
||||||
MappingMetadata filtered = getMappingsResponse.getMappings().get("filtered");
|
MappingMetadata filtered = getMappingsResponse.getMappings().get("filtered");
|
||||||
assertAcked(client().admin().indices().prepareCreate("test").addMapping("_doc", filtered.getSourceAsMap()));
|
assertAcked(client().admin().indices().prepareCreate("test").setMapping(filtered.getSourceAsMap()));
|
||||||
GetFieldMappingsResponse response = client().admin().indices().prepareGetFieldMappings("test").setFields("*").get();
|
GetFieldMappingsResponse response = client().admin().indices().prepareGetFieldMappings("test").setFields("*").get();
|
||||||
assertEquals(1, response.mappings().size());
|
assertEquals(1, response.mappings().size());
|
||||||
assertFieldMappings(response.mappings().get("test"), FILTERED_FLAT_FIELDS);
|
assertFieldMappings(response.mappings().get("test"), FILTERED_FLAT_FIELDS);
|
||||||
|
@ -128,7 +128,7 @@ public class FieldFilterMapperPluginTests extends OpenSearchSingleNodeTestCase {
|
||||||
// as the one coming from a filtered index with same mappings
|
// as the one coming from a filtered index with same mappings
|
||||||
GetMappingsResponse getMappingsResponse = client().admin().indices().prepareGetMappings("filtered").get();
|
GetMappingsResponse getMappingsResponse = client().admin().indices().prepareGetMappings("filtered").get();
|
||||||
MappingMetadata filteredMapping = getMappingsResponse.getMappings().get("filtered");
|
MappingMetadata filteredMapping = getMappingsResponse.getMappings().get("filtered");
|
||||||
assertAcked(client().admin().indices().prepareCreate("test").addMapping("_doc", filteredMapping.getSourceAsMap()));
|
assertAcked(client().admin().indices().prepareCreate("test").setMapping(filteredMapping.getSourceAsMap()));
|
||||||
FieldCapabilitiesResponse test = client().fieldCaps(new FieldCapabilitiesRequest().fields("*").indices("test")).actionGet();
|
FieldCapabilitiesResponse test = client().fieldCaps(new FieldCapabilitiesRequest().fields("*").indices("test")).actionGet();
|
||||||
// properties.value is an object field in the new mapping
|
// properties.value is an object field in the new mapping
|
||||||
filteredFields.add("properties.value");
|
filteredFields.add("properties.value");
|
||||||
|
@ -176,7 +176,7 @@ public class FieldFilterMapperPluginTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
private void assertMappingsAreValid(Map<String, Object> sourceAsMap) {
|
private void assertMappingsAreValid(Map<String, Object> sourceAsMap) {
|
||||||
// check that the returned filtered mappings are still valid mappings by submitting them and retrieving them back
|
// check that the returned filtered mappings are still valid mappings by submitting them and retrieving them back
|
||||||
assertAcked(client().admin().indices().prepareCreate("test").addMapping("_doc", sourceAsMap));
|
assertAcked(client().admin().indices().prepareCreate("test").setMapping(sourceAsMap));
|
||||||
GetMappingsResponse testMappingsResponse = client().admin().indices().prepareGetMappings("test").get();
|
GetMappingsResponse testMappingsResponse = client().admin().indices().prepareGetMappings("test").get();
|
||||||
assertEquals(1, testMappingsResponse.getMappings().size());
|
assertEquals(1, testMappingsResponse.getMappings().size());
|
||||||
// the mappings are returned unfiltered for this index, yet they are the same as the previous ones that were returned filtered
|
// the mappings are returned unfiltered for this index, yet they are the same as the previous ones that were returned filtered
|
||||||
|
|
|
@ -66,7 +66,6 @@ public class NestedHelperTests extends OpenSearchSingleNodeTestCase {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("foo")
|
.startObject("foo")
|
||||||
.field("type", "keyword")
|
.field("type", "keyword")
|
||||||
|
@ -110,7 +109,6 @@ public class NestedHelperTests extends OpenSearchSingleNodeTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
indexService = createIndex("index", Settings.EMPTY, "type", mapping);
|
indexService = createIndex("index", Settings.EMPTY, "type", mapping);
|
||||||
mapperService = indexService.mapperService();
|
mapperService = indexService.mapperService();
|
||||||
|
|
|
@ -100,14 +100,12 @@ public class SimilarityTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testResolveSimilaritiesFromMapping_bm25() throws IOException {
|
public void testResolveSimilaritiesFromMapping_bm25() throws IOException {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("similarity", "my_similarity")
|
.field("similarity", "my_similarity")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
Settings indexSettings = Settings.builder()
|
Settings indexSettings = Settings.builder()
|
||||||
|
@ -131,14 +129,12 @@ public class SimilarityTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testResolveSimilaritiesFromMapping_boolean() throws IOException {
|
public void testResolveSimilaritiesFromMapping_boolean() throws IOException {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("similarity", "boolean")
|
.field("similarity", "boolean")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
MapperService mapperService = createIndex("foo", Settings.EMPTY, "type", mapping).mapperService();
|
MapperService mapperService = createIndex("foo", Settings.EMPTY, "type", mapping).mapperService();
|
||||||
|
@ -148,14 +144,12 @@ public class SimilarityTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testResolveSimilaritiesFromMapping_DFR() throws IOException {
|
public void testResolveSimilaritiesFromMapping_DFR() throws IOException {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("similarity", "my_similarity")
|
.field("similarity", "my_similarity")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
Settings indexSettings = Settings.builder()
|
Settings indexSettings = Settings.builder()
|
||||||
|
@ -178,14 +172,12 @@ public class SimilarityTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testResolveSimilaritiesFromMapping_IB() throws IOException {
|
public void testResolveSimilaritiesFromMapping_IB() throws IOException {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("similarity", "my_similarity")
|
.field("similarity", "my_similarity")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
Settings indexSettings = Settings.builder()
|
Settings indexSettings = Settings.builder()
|
||||||
|
@ -208,14 +200,12 @@ public class SimilarityTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testResolveSimilaritiesFromMapping_DFI() throws IOException {
|
public void testResolveSimilaritiesFromMapping_DFI() throws IOException {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("similarity", "my_similarity")
|
.field("similarity", "my_similarity")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
Settings indexSettings = Settings.builder()
|
Settings indexSettings = Settings.builder()
|
||||||
|
@ -233,14 +223,12 @@ public class SimilarityTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testResolveSimilaritiesFromMapping_LMDirichlet() throws IOException {
|
public void testResolveSimilaritiesFromMapping_LMDirichlet() throws IOException {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("similarity", "my_similarity")
|
.field("similarity", "my_similarity")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
Settings indexSettings = Settings.builder()
|
Settings indexSettings = Settings.builder()
|
||||||
|
@ -261,14 +249,12 @@ public class SimilarityTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testResolveSimilaritiesFromMapping_LMJelinekMercer() throws IOException {
|
public void testResolveSimilaritiesFromMapping_LMJelinekMercer() throws IOException {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("similarity", "my_similarity")
|
.field("similarity", "my_similarity")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
Settings indexSettings = Settings.builder()
|
Settings indexSettings = Settings.builder()
|
||||||
|
@ -292,7 +278,6 @@ public class SimilarityTests extends OpenSearchSingleNodeTestCase {
|
||||||
String mapping = Strings.toString(
|
String mapping = Strings.toString(
|
||||||
XContentFactory.jsonBuilder()
|
XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field1")
|
.startObject("field1")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -300,7 +285,6 @@ public class SimilarityTests extends OpenSearchSingleNodeTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
IndexService indexService = createIndex("foo");
|
IndexService indexService = createIndex("foo");
|
||||||
|
|
|
@ -60,14 +60,12 @@ public class TermVectorsServiceTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
public void testTook() throws Exception {
|
public void testTook() throws Exception {
|
||||||
XContentBuilder mapping = jsonBuilder().startObject()
|
XContentBuilder mapping = jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("field")
|
.startObject("field")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("term_vector", "with_positions_offsets_payloads")
|
.field("term_vector", "with_positions_offsets_payloads")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
createIndex("test", Settings.EMPTY, "type1", mapping);
|
createIndex("test", Settings.EMPTY, "type1", mapping);
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -90,14 +88,12 @@ public class TermVectorsServiceTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
public void testDocFreqs() throws IOException {
|
public void testDocFreqs() throws IOException {
|
||||||
XContentBuilder mapping = jsonBuilder().startObject()
|
XContentBuilder mapping = jsonBuilder().startObject()
|
||||||
.startObject("_doc")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("text")
|
.startObject("text")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
.field("term_vector", "with_positions_offsets_payloads")
|
.field("term_vector", "with_positions_offsets_payloads")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
Settings settings = Settings.builder().put("number_of_shards", 1).build();
|
Settings settings = Settings.builder().put("number_of_shards", 1).build();
|
||||||
createIndex("test", settings, "_doc", mapping);
|
createIndex("test", settings, "_doc", mapping);
|
||||||
|
@ -130,7 +126,6 @@ public class TermVectorsServiceTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
public void testWithIndexedPhrases() throws IOException {
|
public void testWithIndexedPhrases() throws IOException {
|
||||||
XContentBuilder mapping = jsonBuilder().startObject()
|
XContentBuilder mapping = jsonBuilder().startObject()
|
||||||
.startObject("_doc")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("text")
|
.startObject("text")
|
||||||
.field("type", "text")
|
.field("type", "text")
|
||||||
|
@ -138,7 +133,6 @@ public class TermVectorsServiceTests extends OpenSearchSingleNodeTestCase {
|
||||||
.field("term_vector", "with_positions_offsets_payloads")
|
.field("term_vector", "with_positions_offsets_payloads")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
Settings settings = Settings.builder().put("number_of_shards", 1).build();
|
Settings settings = Settings.builder().put("number_of_shards", 1).build();
|
||||||
createIndex("test", settings, "_doc", mapping);
|
createIndex("test", settings, "_doc", mapping);
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class GeoPointShapeQueryTests extends GeoQueryTests {
|
||||||
|
|
||||||
public void testProcessRelationSupport() throws Exception {
|
public void testProcessRelationSupport() throws Exception {
|
||||||
XContentBuilder xcb = createDefaultMapping();
|
XContentBuilder xcb = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate("test").addMapping("_doc", xcb).get();
|
client().admin().indices().prepareCreate("test").setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
Rectangle rectangle = new Rectangle(-35, -25, -25, -35);
|
Rectangle rectangle = new Rectangle(-35, -25, -25, -35);
|
||||||
|
@ -112,7 +112,7 @@ public class GeoPointShapeQueryTests extends GeoQueryTests {
|
||||||
|
|
||||||
public void testQueryLine() throws Exception {
|
public void testQueryLine() throws Exception {
|
||||||
XContentBuilder xcb = createDefaultMapping();
|
XContentBuilder xcb = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate("test").addMapping("_doc", xcb).get();
|
client().admin().indices().prepareCreate("test").setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
Line line = new Line(new double[] { -25, -25 }, new double[] { -35, -35 });
|
Line line = new Line(new double[] { -25, -25 }, new double[] { -35, -35 });
|
||||||
|
@ -126,7 +126,7 @@ public class GeoPointShapeQueryTests extends GeoQueryTests {
|
||||||
|
|
||||||
public void testQueryLinearRing() throws Exception {
|
public void testQueryLinearRing() throws Exception {
|
||||||
XContentBuilder xcb = createDefaultMapping();
|
XContentBuilder xcb = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate("test").addMapping("_doc", xcb).get();
|
client().admin().indices().prepareCreate("test").setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
LinearRing linearRing = new LinearRing(new double[] { -25, -35, -25 }, new double[] { -25, -35, -25 });
|
LinearRing linearRing = new LinearRing(new double[] { -25, -35, -25 }, new double[] { -25, -35, -25 });
|
||||||
|
@ -148,7 +148,7 @@ public class GeoPointShapeQueryTests extends GeoQueryTests {
|
||||||
|
|
||||||
public void testQueryMultiLine() throws Exception {
|
public void testQueryMultiLine() throws Exception {
|
||||||
XContentBuilder xcb = createDefaultMapping();
|
XContentBuilder xcb = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate("test").addMapping("_doc", xcb).get();
|
client().admin().indices().prepareCreate("test").setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
CoordinatesBuilder coords1 = new CoordinatesBuilder().coordinate(-35, -35).coordinate(-25, -25);
|
CoordinatesBuilder coords1 = new CoordinatesBuilder().coordinate(-35, -35).coordinate(-25, -25);
|
||||||
|
@ -167,7 +167,7 @@ public class GeoPointShapeQueryTests extends GeoQueryTests {
|
||||||
|
|
||||||
public void testQueryMultiPoint() throws Exception {
|
public void testQueryMultiPoint() throws Exception {
|
||||||
XContentBuilder xcb = createDefaultMapping();
|
XContentBuilder xcb = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate("test").addMapping("_doc", xcb).get();
|
client().admin().indices().prepareCreate("test").setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
MultiPointBuilder mpb = new MultiPointBuilder().coordinate(-35, -25).coordinate(-15, -5);
|
MultiPointBuilder mpb = new MultiPointBuilder().coordinate(-35, -25).coordinate(-15, -5);
|
||||||
|
@ -182,7 +182,7 @@ public class GeoPointShapeQueryTests extends GeoQueryTests {
|
||||||
|
|
||||||
public void testQueryPoint() throws Exception {
|
public void testQueryPoint() throws Exception {
|
||||||
XContentBuilder xcb = createDefaultMapping();
|
XContentBuilder xcb = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate("test").addMapping("_doc", xcb).get();
|
client().admin().indices().prepareCreate("test").setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
PointBuilder pb = new PointBuilder().coordinate(-35, -25);
|
PointBuilder pb = new PointBuilder().coordinate(-35, -25);
|
||||||
|
|
|
@ -82,7 +82,7 @@ public abstract class GeoQueryTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
public void testNullShape() throws Exception {
|
public void testNullShape() throws Exception {
|
||||||
XContentBuilder xcb = createDefaultMapping();
|
XContentBuilder xcb = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate(defaultIndexName).addMapping("_doc", xcb).get();
|
client().admin().indices().prepareCreate(defaultIndexName).setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex(defaultIndexName)
|
client().prepareIndex(defaultIndexName)
|
||||||
|
@ -96,7 +96,7 @@ public abstract class GeoQueryTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
public void testIndexPointsFilterRectangle() throws Exception {
|
public void testIndexPointsFilterRectangle() throws Exception {
|
||||||
XContentBuilder xcb = createDefaultMapping();
|
XContentBuilder xcb = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate(defaultIndexName).addMapping("_doc", xcb).get();
|
client().admin().indices().prepareCreate(defaultIndexName).setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex(defaultIndexName)
|
client().prepareIndex(defaultIndexName)
|
||||||
|
@ -134,7 +134,7 @@ public abstract class GeoQueryTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
public void testIndexPointsCircle() throws Exception {
|
public void testIndexPointsCircle() throws Exception {
|
||||||
XContentBuilder xcb = createDefaultMapping();
|
XContentBuilder xcb = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate(defaultIndexName).addMapping("_doc", xcb).get();
|
client().admin().indices().prepareCreate(defaultIndexName).setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex(defaultIndexName)
|
client().prepareIndex(defaultIndexName)
|
||||||
|
@ -167,7 +167,7 @@ public abstract class GeoQueryTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
public void testIndexPointsPolygon() throws Exception {
|
public void testIndexPointsPolygon() throws Exception {
|
||||||
XContentBuilder xcb = createDefaultMapping();
|
XContentBuilder xcb = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate(defaultIndexName).addMapping("_doc", xcb).get();
|
client().admin().indices().prepareCreate(defaultIndexName).setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex(defaultIndexName)
|
client().prepareIndex(defaultIndexName)
|
||||||
|
@ -203,7 +203,7 @@ public abstract class GeoQueryTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
public void testIndexPointsMultiPolygon() throws Exception {
|
public void testIndexPointsMultiPolygon() throws Exception {
|
||||||
XContentBuilder xcb = createDefaultMapping();
|
XContentBuilder xcb = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate(defaultIndexName).addMapping("_doc", xcb).get();
|
client().admin().indices().prepareCreate(defaultIndexName).setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex(defaultIndexName)
|
client().prepareIndex(defaultIndexName)
|
||||||
|
@ -257,7 +257,7 @@ public abstract class GeoQueryTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
public void testIndexPointsRectangle() throws Exception {
|
public void testIndexPointsRectangle() throws Exception {
|
||||||
XContentBuilder xcb = createDefaultMapping();
|
XContentBuilder xcb = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate(defaultIndexName).addMapping("_doc", xcb).get();
|
client().admin().indices().prepareCreate(defaultIndexName).setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex(defaultIndexName)
|
client().prepareIndex(defaultIndexName)
|
||||||
|
@ -285,7 +285,7 @@ public abstract class GeoQueryTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
public void testIndexPointsIndexedRectangle() throws Exception {
|
public void testIndexPointsIndexedRectangle() throws Exception {
|
||||||
XContentBuilder xcb = createDefaultMapping();
|
XContentBuilder xcb = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate(defaultIndexName).addMapping(defaultIndexName, xcb).get();
|
client().admin().indices().prepareCreate(defaultIndexName).setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex(defaultIndexName)
|
client().prepareIndex(defaultIndexName)
|
||||||
|
@ -310,7 +310,7 @@ public abstract class GeoQueryTests extends OpenSearchSingleNodeTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject();
|
.endObject();
|
||||||
client().admin().indices().prepareCreate(indexedShapeIndex).addMapping(defaultIndexName, xcb).get();
|
client().admin().indices().prepareCreate(indexedShapeIndex).setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex(indexedShapeIndex)
|
client().prepareIndex(indexedShapeIndex)
|
||||||
|
@ -352,7 +352,7 @@ public abstract class GeoQueryTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
public void testRectangleSpanningDateline() throws Exception {
|
public void testRectangleSpanningDateline() throws Exception {
|
||||||
XContentBuilder xcb = createDefaultMapping();
|
XContentBuilder xcb = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate("test").addMapping("_doc", xcb).get();
|
client().admin().indices().prepareCreate("test").setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex(defaultIndexName)
|
client().prepareIndex(defaultIndexName)
|
||||||
|
@ -385,7 +385,7 @@ public abstract class GeoQueryTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
public void testPolygonSpanningDateline() throws Exception {
|
public void testPolygonSpanningDateline() throws Exception {
|
||||||
XContentBuilder xcb = createDefaultMapping();
|
XContentBuilder xcb = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate("test").addMapping("_doc", xcb).get();
|
client().admin().indices().prepareCreate("test").setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex(defaultIndexName)
|
client().prepareIndex(defaultIndexName)
|
||||||
|
@ -429,7 +429,7 @@ public abstract class GeoQueryTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
public void testMultiPolygonSpanningDateline() throws Exception {
|
public void testMultiPolygonSpanningDateline() throws Exception {
|
||||||
XContentBuilder xcb = createDefaultMapping();
|
XContentBuilder xcb = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate("test").addMapping("_doc", xcb).get();
|
client().admin().indices().prepareCreate("test").setMapping(xcb).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
client().prepareIndex(defaultIndexName)
|
client().prepareIndex(defaultIndexName)
|
||||||
|
|
|
@ -262,7 +262,7 @@ public class GeoShapeQueryTests extends GeoQueryTests {
|
||||||
|
|
||||||
XContentBuilder mapping = createRandomMapping();
|
XContentBuilder mapping = createRandomMapping();
|
||||||
Settings settings = Settings.builder().put("index.number_of_shards", 1).build();
|
Settings settings = Settings.builder().put("index.number_of_shards", 1).build();
|
||||||
client().admin().indices().prepareCreate("test").addMapping("_doc", mapping).setSettings(settings).get();
|
client().admin().indices().prepareCreate("test").setMapping(mapping).setSettings(settings).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
XContentBuilder docSource = gcb.toXContent(jsonBuilder().startObject().field("geo"), null).endObject();
|
XContentBuilder docSource = gcb.toXContent(jsonBuilder().startObject().field("geo"), null).endObject();
|
||||||
|
@ -282,7 +282,7 @@ public class GeoShapeQueryTests extends GeoQueryTests {
|
||||||
// Test for issue #34418
|
// Test for issue #34418
|
||||||
public void testEnvelopeSpanningDateline() throws Exception {
|
public void testEnvelopeSpanningDateline() throws Exception {
|
||||||
XContentBuilder mapping = createDefaultMapping();
|
XContentBuilder mapping = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate("test").addMapping("_doc", mapping).get();
|
client().admin().indices().prepareCreate("test").setMapping(mapping).get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
String doc1 = "{\"geo\": {\r\n"
|
String doc1 = "{\"geo\": {\r\n"
|
||||||
|
@ -488,7 +488,7 @@ public class GeoShapeQueryTests extends GeoQueryTests {
|
||||||
|
|
||||||
public void testIndexedShapeReferenceSourceDisabled() throws Exception {
|
public void testIndexedShapeReferenceSourceDisabled() throws Exception {
|
||||||
XContentBuilder mapping = createDefaultMapping();
|
XContentBuilder mapping = createDefaultMapping();
|
||||||
client().admin().indices().prepareCreate("test").addMapping("type1", mapping).get();
|
client().admin().indices().prepareCreate("test").setMapping(mapping).get();
|
||||||
createIndex("shapes", Settings.EMPTY, "shape_type", "_source", "enabled=false");
|
createIndex("shapes", Settings.EMPTY, "shape_type", "_source", "enabled=false");
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
|
@ -612,7 +612,7 @@ public class GeoShapeQueryTests extends GeoQueryTests {
|
||||||
GeometryCollectionBuilder gcb = RandomShapeGenerator.createGeometryCollection(random());
|
GeometryCollectionBuilder gcb = RandomShapeGenerator.createGeometryCollection(random());
|
||||||
|
|
||||||
XContentBuilder builder = createRandomMapping();
|
XContentBuilder builder = createRandomMapping();
|
||||||
client().admin().indices().prepareCreate("test").addMapping("type", builder).execute().actionGet();
|
client().admin().indices().prepareCreate("test").setMapping(builder).execute().actionGet();
|
||||||
|
|
||||||
XContentBuilder docSource = gcb.toXContent(jsonBuilder().startObject().field("geo"), null).endObject();
|
XContentBuilder docSource = gcb.toXContent(jsonBuilder().startObject().field("geo"), null).endObject();
|
||||||
client().prepareIndex("test").setId("1").setSource(docSource).setRefreshPolicy(IMMEDIATE).get();
|
client().prepareIndex("test").setId("1").setSource(docSource).setRefreshPolicy(IMMEDIATE).get();
|
||||||
|
@ -748,7 +748,6 @@ public class GeoShapeQueryTests extends GeoQueryTests {
|
||||||
public void testFieldAlias() throws IOException {
|
public void testFieldAlias() throws IOException {
|
||||||
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
XContentBuilder mapping = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("type")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("location")
|
.startObject("location")
|
||||||
.field("type", "geo_shape")
|
.field("type", "geo_shape")
|
||||||
|
@ -759,7 +758,6 @@ public class GeoShapeQueryTests extends GeoQueryTests {
|
||||||
.field("path", "location")
|
.field("path", "location")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
createIndex("test", Settings.EMPTY, "type", mapping);
|
createIndex("test", Settings.EMPTY, "type", mapping);
|
||||||
|
@ -786,7 +784,7 @@ public class GeoShapeQueryTests extends GeoQueryTests {
|
||||||
gcb.shape(new PolygonBuilder(cb));
|
gcb.shape(new PolygonBuilder(cb));
|
||||||
|
|
||||||
XContentBuilder builder = createRandomMapping();
|
XContentBuilder builder = createRandomMapping();
|
||||||
client().admin().indices().prepareCreate("test").addMapping("type", builder).get();
|
client().admin().indices().prepareCreate("test").setMapping(builder).get();
|
||||||
|
|
||||||
XContentBuilder docSource = gcb.toXContent(jsonBuilder().startObject().field("geo"), null).endObject();
|
XContentBuilder docSource = gcb.toXContent(jsonBuilder().startObject().field("geo"), null).endObject();
|
||||||
client().prepareIndex("test").setId("1").setSource(docSource).setRefreshPolicy(IMMEDIATE).get();
|
client().prepareIndex("test").setId("1").setSource(docSource).setRefreshPolicy(IMMEDIATE).get();
|
||||||
|
|
|
@ -77,7 +77,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testIndexingWithNoContexts() throws Exception {
|
public void testIndexingWithNoContexts() throws Exception {
|
||||||
String mapping = Strings.toString(
|
String mapping = Strings.toString(
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("completion")
|
.startObject("completion")
|
||||||
.field("type", "completion")
|
.field("type", "completion")
|
||||||
|
@ -90,7 +89,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
||||||
|
@ -129,7 +127,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testIndexingWithSimpleContexts() throws Exception {
|
public void testIndexingWithSimpleContexts() throws Exception {
|
||||||
String mapping = Strings.toString(
|
String mapping = Strings.toString(
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("completion")
|
.startObject("completion")
|
||||||
.field("type", "completion")
|
.field("type", "completion")
|
||||||
|
@ -142,7 +139,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
||||||
|
@ -176,7 +172,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testIndexingWithSimpleNumberContexts() throws Exception {
|
public void testIndexingWithSimpleNumberContexts() throws Exception {
|
||||||
String mapping = Strings.toString(
|
String mapping = Strings.toString(
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("completion")
|
.startObject("completion")
|
||||||
.field("type", "completion")
|
.field("type", "completion")
|
||||||
|
@ -189,7 +184,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
||||||
|
@ -223,7 +217,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testIndexingWithSimpleBooleanContexts() throws Exception {
|
public void testIndexingWithSimpleBooleanContexts() throws Exception {
|
||||||
String mapping = Strings.toString(
|
String mapping = Strings.toString(
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("completion")
|
.startObject("completion")
|
||||||
.field("type", "completion")
|
.field("type", "completion")
|
||||||
|
@ -236,7 +229,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
||||||
|
@ -270,7 +262,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testIndexingWithSimpleNULLContexts() throws Exception {
|
public void testIndexingWithSimpleNULLContexts() throws Exception {
|
||||||
String mapping = Strings.toString(
|
String mapping = Strings.toString(
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("completion")
|
.startObject("completion")
|
||||||
.field("type", "completion")
|
.field("type", "completion")
|
||||||
|
@ -283,7 +274,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
||||||
|
@ -314,7 +304,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testIndexingWithContextList() throws Exception {
|
public void testIndexingWithContextList() throws Exception {
|
||||||
String mapping = Strings.toString(
|
String mapping = Strings.toString(
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("completion")
|
.startObject("completion")
|
||||||
.field("type", "completion")
|
.field("type", "completion")
|
||||||
|
@ -327,7 +316,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
||||||
|
@ -359,7 +347,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testIndexingWithMixedTypeContextList() throws Exception {
|
public void testIndexingWithMixedTypeContextList() throws Exception {
|
||||||
String mapping = Strings.toString(
|
String mapping = Strings.toString(
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("completion")
|
.startObject("completion")
|
||||||
.field("type", "completion")
|
.field("type", "completion")
|
||||||
|
@ -372,7 +359,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
||||||
|
@ -404,7 +390,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testIndexingWithMixedTypeContextListHavingNULL() throws Exception {
|
public void testIndexingWithMixedTypeContextListHavingNULL() throws Exception {
|
||||||
String mapping = Strings.toString(
|
String mapping = Strings.toString(
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("completion")
|
.startObject("completion")
|
||||||
.field("type", "completion")
|
.field("type", "completion")
|
||||||
|
@ -417,7 +402,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
||||||
|
@ -443,7 +427,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testIndexingWithMultipleContexts() throws Exception {
|
public void testIndexingWithMultipleContexts() throws Exception {
|
||||||
String mapping = Strings.toString(
|
String mapping = Strings.toString(
|
||||||
jsonBuilder().startObject()
|
jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("completion")
|
.startObject("completion")
|
||||||
.field("type", "completion")
|
.field("type", "completion")
|
||||||
|
@ -460,7 +443,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
DocumentMapper defaultMapper = createIndex("test").mapperService()
|
||||||
|
@ -798,7 +780,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
public void testUnknownQueryContextParsing() throws Exception {
|
public void testUnknownQueryContextParsing() throws Exception {
|
||||||
XContentBuilder mapping = jsonBuilder().startObject()
|
XContentBuilder mapping = jsonBuilder().startObject()
|
||||||
.startObject("type1")
|
|
||||||
.startObject("properties")
|
.startObject("properties")
|
||||||
.startObject("completion")
|
.startObject("completion")
|
||||||
.field("type", "completion")
|
.field("type", "completion")
|
||||||
|
@ -814,7 +795,6 @@ public class CategoryContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
.endArray()
|
.endArray()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
|
||||||
.endObject();
|
.endObject();
|
||||||
|
|
||||||
MapperService mapperService = createIndex("test", Settings.EMPTY, "type1", mapping).mapperService();
|
MapperService mapperService = createIndex("test", Settings.EMPTY, "type1", mapping).mapperService();
|
||||||
|
|
|
@ -245,7 +245,6 @@ public class GeoContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testMalformedGeoField() throws Exception {
|
public void testMalformedGeoField() throws Exception {
|
||||||
XContentBuilder mapping = jsonBuilder();
|
XContentBuilder mapping = jsonBuilder();
|
||||||
mapping.startObject();
|
mapping.startObject();
|
||||||
mapping.startObject("type1");
|
|
||||||
mapping.startObject("properties");
|
mapping.startObject("properties");
|
||||||
mapping.startObject("pin");
|
mapping.startObject("pin");
|
||||||
String type = randomFrom("text", "keyword", "long");
|
String type = randomFrom("text", "keyword", "long");
|
||||||
|
@ -266,7 +265,6 @@ public class GeoContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
mapping.endObject();
|
mapping.endObject();
|
||||||
|
|
||||||
mapping.endObject();
|
|
||||||
mapping.endObject();
|
mapping.endObject();
|
||||||
mapping.endObject();
|
mapping.endObject();
|
||||||
|
|
||||||
|
@ -281,7 +279,6 @@ public class GeoContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
public void testMissingGeoField() throws Exception {
|
public void testMissingGeoField() throws Exception {
|
||||||
XContentBuilder mapping = jsonBuilder();
|
XContentBuilder mapping = jsonBuilder();
|
||||||
mapping.startObject();
|
mapping.startObject();
|
||||||
mapping.startObject("type1");
|
|
||||||
mapping.startObject("properties");
|
mapping.startObject("properties");
|
||||||
mapping.startObject("suggestion");
|
mapping.startObject("suggestion");
|
||||||
mapping.field("type", "completion");
|
mapping.field("type", "completion");
|
||||||
|
@ -298,7 +295,6 @@ public class GeoContextMappingTests extends OpenSearchSingleNodeTestCase {
|
||||||
|
|
||||||
mapping.endObject();
|
mapping.endObject();
|
||||||
|
|
||||||
mapping.endObject();
|
|
||||||
mapping.endObject();
|
mapping.endObject();
|
||||||
mapping.endObject();
|
mapping.endObject();
|
||||||
|
|
||||||
|
|
|
@ -63,8 +63,7 @@ public final class RandomCreateIndexGenerator {
|
||||||
CreateIndexRequest request = new CreateIndexRequest(index);
|
CreateIndexRequest request = new CreateIndexRequest(index);
|
||||||
randomAliases(request);
|
randomAliases(request);
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
String type = randomAlphaOfLength(5);
|
request.mapping(randomMapping());
|
||||||
request.mapping(type, randomMapping(type));
|
|
||||||
}
|
}
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
request.settings(randomIndexSettings());
|
request.settings(randomIndexSettings());
|
||||||
|
@ -94,16 +93,15 @@ public final class RandomCreateIndexGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a random mapping, with the mapping definition nested
|
* Creates a random mapping
|
||||||
* under the given type name.
|
|
||||||
*/
|
*/
|
||||||
public static XContentBuilder randomMapping(String type) throws IOException {
|
public static XContentBuilder randomMapping() throws IOException {
|
||||||
XContentBuilder builder = XContentFactory.contentBuilder(randomFrom(XContentType.values()));
|
XContentBuilder builder = XContentFactory.contentBuilder(randomFrom(XContentType.values()));
|
||||||
builder.startObject().startObject(type);
|
builder.startObject();
|
||||||
|
|
||||||
randomMappingFields(builder, true);
|
randomMappingFields(builder, true);
|
||||||
|
|
||||||
builder.endObject().endObject();
|
builder.endObject();
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -310,7 +310,7 @@ public abstract class OpenSearchSingleNodeTestCase extends OpenSearchTestCase {
|
||||||
protected IndexService createIndex(String index, Settings settings, String type, XContentBuilder mappings) {
|
protected IndexService createIndex(String index, Settings settings, String type, XContentBuilder mappings) {
|
||||||
CreateIndexRequestBuilder createIndexRequestBuilder = client().admin().indices().prepareCreate(index).setSettings(settings);
|
CreateIndexRequestBuilder createIndexRequestBuilder = client().admin().indices().prepareCreate(index).setSettings(settings);
|
||||||
if (type != null && mappings != null) {
|
if (type != null && mappings != null) {
|
||||||
createIndexRequestBuilder.addMapping(type, mappings);
|
createIndexRequestBuilder.setMapping(mappings);
|
||||||
}
|
}
|
||||||
return createIndex(index, createIndexRequestBuilder);
|
return createIndex(index, createIndexRequestBuilder);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue