Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Remove] Types from PutIndexTemplateRequest and builder to reduce mapping to a string #2510

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,9 @@ public void testIndexTemplates() throws Exception {
.preparePutTemplate("foo_template")
.setPatterns(Collections.singletonList("te*"))
.setOrder(0)
.addMapping(
"type1",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field1")
.field("type", "text")
Expand All @@ -182,7 +180,6 @@ public void testIndexTemplates() throws Exception {
.endObject()
.endObject()
.endObject()
.endObject()
)
.get();

Expand All @@ -191,19 +188,16 @@ public void testIndexTemplates() throws Exception {
.preparePutTemplate("fuu_template")
.setPatterns(Collections.singletonList("test*"))
.setOrder(1)
.addMapping(
"type1",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field2")
.field("type", "text")
.field("store", false)
.endObject()
.endObject()
.endObject()
.endObject()
)
.get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,11 +461,9 @@ public void testLatestVersionLoaded() throws Exception {
.preparePutTemplate("template_1")
.setPatterns(Collections.singletonList("te*"))
.setOrder(0)
.addMapping(
"type1",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field1")
.field("type", "text")
Expand All @@ -477,7 +475,6 @@ public void testLatestVersionLoaded() throws Exception {
.endObject()
.endObject()
.endObject()
.endObject()
)
.execute()
.actionGet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ public void testIndexTemplatesWithBlocks() throws IOException {
.preparePutTemplate("template_blocks")
.setPatterns(Collections.singletonList("te*"))
.setOrder(0)
.addMapping(
"type1",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field1")
.field("type", "text")
Expand All @@ -70,7 +68,6 @@ public void testIndexTemplatesWithBlocks() throws IOException {
.endObject()
.endObject()
.endObject()
.endObject()
)
.execute()
.actionGet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,9 @@ public void testSimpleIndexTemplateTests() throws Exception {
.setPatterns(Collections.singletonList("te*"))
.setSettings(indexSettings())
.setOrder(0)
.addMapping(
"type1",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field1")
.field("type", "text")
Expand All @@ -126,7 +124,6 @@ public void testSimpleIndexTemplateTests() throws Exception {
.endObject()
.endObject()
.endObject()
.endObject()
)
.get();

Expand All @@ -136,19 +133,16 @@ public void testSimpleIndexTemplateTests() throws Exception {
.setPatterns(Collections.singletonList("test*"))
.setSettings(indexSettings())
.setOrder(1)
.addMapping(
"type1",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field2")
.field("type", "text")
.field("store", false)
.endObject()
.endObject()
.endObject()
.endObject()
)
.get();

Expand All @@ -161,19 +155,16 @@ public void testSimpleIndexTemplateTests() throws Exception {
.setSettings(indexSettings())
.setCreate(true)
.setOrder(1)
.addMapping(
"type1",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field2")
.field("type", "text")
.field("store", false)
.endObject()
.endObject()
.endObject()
.endObject()
),
IllegalArgumentException.class
);
Expand Down Expand Up @@ -223,11 +214,9 @@ public void testDeleteIndexTemplate() throws Exception {
.preparePutTemplate("template_1")
.setPatterns(Collections.singletonList("te*"))
.setOrder(0)
.addMapping(
"type1",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field1")
.field("type", "text")
Expand All @@ -239,7 +228,6 @@ public void testDeleteIndexTemplate() throws Exception {
.endObject()
.endObject()
.endObject()
.endObject()
)
.execute()
.actionGet();
Expand All @@ -249,19 +237,16 @@ public void testDeleteIndexTemplate() throws Exception {
.preparePutTemplate("template_2")
.setPatterns(Collections.singletonList("test*"))
.setOrder(1)
.addMapping(
"type1",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field2")
.field("type", "text")
.field("store", false)
.endObject()
.endObject()
.endObject()
.endObject()
)
.execute()
.actionGet();
Expand All @@ -281,11 +266,9 @@ public void testDeleteIndexTemplate() throws Exception {
.preparePutTemplate("template_1")
.setPatterns(Collections.singletonList("te*"))
.setOrder(0)
.addMapping(
"type1",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field1")
.field("type", "text")
Expand All @@ -297,7 +280,6 @@ public void testDeleteIndexTemplate() throws Exception {
.endObject()
.endObject()
.endObject()
.endObject()
)
.execute()
.actionGet();
Expand All @@ -322,11 +304,9 @@ public void testThatGetIndexTemplatesWorks() throws Exception {
.setPatterns(Collections.singletonList("te*"))
.setOrder(0)
.setVersion(123)
.addMapping(
"type1",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field1")
.field("type", "text")
Expand All @@ -338,7 +318,6 @@ public void testThatGetIndexTemplatesWorks() throws Exception {
.endObject()
.endObject()
.endObject()
.endObject()
)
.execute()
.actionGet();
Expand Down Expand Up @@ -367,11 +346,9 @@ public void testThatGetIndexTemplatesWithSimpleRegexWorks() throws Exception {
.preparePutTemplate("template_1")
.setPatterns(Collections.singletonList("te*"))
.setOrder(0)
.addMapping(
"type1",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field1")
.field("type", "text")
Expand All @@ -383,7 +360,6 @@ public void testThatGetIndexTemplatesWithSimpleRegexWorks() throws Exception {
.endObject()
.endObject()
.endObject()
.endObject()
)
.execute()
.actionGet();
Expand All @@ -394,11 +370,9 @@ public void testThatGetIndexTemplatesWithSimpleRegexWorks() throws Exception {
.preparePutTemplate("template_2")
.setPatterns(Collections.singletonList("te*"))
.setOrder(0)
.addMapping(
"type1",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field1")
.field("type", "text")
Expand All @@ -410,7 +384,6 @@ public void testThatGetIndexTemplatesWithSimpleRegexWorks() throws Exception {
.endObject()
.endObject()
.endObject()
.endObject()
)
.execute()
.actionGet();
Expand All @@ -421,11 +394,9 @@ public void testThatGetIndexTemplatesWithSimpleRegexWorks() throws Exception {
.preparePutTemplate("template3")
.setPatterns(Collections.singletonList("te*"))
.setOrder(0)
.addMapping(
"type1",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field1")
.field("type", "text")
Expand All @@ -437,7 +408,6 @@ public void testThatGetIndexTemplatesWithSimpleRegexWorks() throws Exception {
.endObject()
.endObject()
.endObject()
.endObject()
)
.execute()
.actionGet();
Expand Down Expand Up @@ -507,7 +477,7 @@ public void testBrokenMapping() throws Exception {
.indices()
.preparePutTemplate("template_1")
.setPatterns(Collections.singletonList("te*"))
.addMapping("type1", "{\"foo\": \"abcde\"}", XContentType.JSON)
.setMapping("{\"foo\": \"abcde\"}", XContentType.JSON)
.get()
);
assertThat(e.getMessage(), containsString("Failed to parse mapping "));
Expand Down Expand Up @@ -896,19 +866,16 @@ public void testCombineTemplates() throws Exception {
.setPatterns(Collections.singletonList("test*"))
.setCreate(true)
.setOrder(1)
.addMapping(
"type1",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field2")
.field("type", "text")
.field("analyzer", "custom_1")
.endObject()
.endObject()
.endObject()
.endObject()
)
.get()
);
Expand Down Expand Up @@ -946,11 +913,9 @@ public void testMultipleTemplate() throws IOException {
.preparePutTemplate("template_1")
.setPatterns(Arrays.asList("a*", "b*"))
.setSettings(indexSettings())
.addMapping(
"type1",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field1")
.field("type", "text")
Expand All @@ -962,7 +927,6 @@ public void testMultipleTemplate() throws IOException {
.endObject()
.endObject()
.endObject()
.endObject()
)
.get();

Expand Down Expand Up @@ -1027,7 +991,7 @@ public void testPartitionedTemplate() throws Exception {
.indices()
.preparePutTemplate("template_2")
.setPatterns(Collections.singletonList("te*"))
.addMapping("type", "{\"type\":{\"_routing\":{\"required\":false}}}", XContentType.JSON)
.setMapping("{\"_routing\":{\"required\":false}}", XContentType.JSON)
.setSettings(Settings.builder().put("index.number_of_shards", "6").put("index.routing_partition_size", "3"))
.get()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,9 @@ public void testRestoreTemplates() throws Exception {
.indices()
.preparePutTemplate("test-template")
.setPatterns(Collections.singletonList("te*"))
.addMapping(
"_doc",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("_doc")
.startObject("properties")
.startObject("field1")
.field("type", "text")
Expand All @@ -440,7 +438,6 @@ public void testRestoreTemplates() throws Exception {
.endObject()
.endObject()
.endObject()
.endObject()
)
.get()
.isAcknowledged(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,9 @@ public void testIncludeGlobalState() throws Exception {
.indices()
.preparePutTemplate("test-template")
.setPatterns(Collections.singletonList("te*"))
.addMapping(
"_doc",
.setMapping(
XContentFactory.jsonBuilder()
.startObject()
.startObject("_doc")
.startObject("properties")
.startObject("field1")
.field("type", "text")
Expand All @@ -97,7 +95,6 @@ public void testIncludeGlobalState() throws Exception {
.endObject()
.endObject()
.endObject()
.endObject()
)
.get()
.isAcknowledged(),
Expand Down
Loading