Set mappings when creating indices in SuggestSearchIT (#39323)

* Set mappings when creating indices in SuggestSearchIT

These tests don't test dynamic mapping, so they can use preset mappings. This
removes the possibility they may fail due to the mapping not being available
since mapping updates are asynchronous.

Resolves #39315

* Wrap creates in assertAcked
This commit is contained in:
Lee Hinman 2019-02-25 13:26:41 -07:00 committed by Lee Hinman
parent 926291aac8
commit 5c7dd6f0ee
1 changed files with 5 additions and 5 deletions

View File

@ -83,7 +83,7 @@ public class SuggestSearchIT extends ESIntegTestCase {
// see #3196
public void testSuggestAcrossMultipleIndices() throws IOException {
createIndex("test");
assertAcked(prepareCreate("test").addMapping("type1", "text", "type=text"));
ensureGreen();
index("test", "type1", "1", "text", "abcd");
@ -97,7 +97,7 @@ public class SuggestSearchIT extends ESIntegTestCase {
.text("abcd");
logger.info("--> run suggestions with one index");
searchSuggest("test", termSuggest);
createIndex("test_1");
assertAcked(prepareCreate("test_1").addMapping("type1", "text", "type=text"));
ensureGreen();
index("test_1", "type1", "1", "text", "ab cd");
@ -302,7 +302,7 @@ public class SuggestSearchIT extends ESIntegTestCase {
}
public void testSimple() throws Exception {
createIndex("test");
assertAcked(prepareCreate("test").addMapping("type1", "text", "type=text"));
ensureGreen();
index("test", "type1", "1", "text", "abcd");
@ -327,7 +327,7 @@ public class SuggestSearchIT extends ESIntegTestCase {
}
public void testEmpty() throws Exception {
createIndex("test");
assertAcked(prepareCreate("test").addMapping("type1", "text", "type=text"));
ensureGreen();
index("test", "type1", "1", "text", "bar");
@ -346,7 +346,7 @@ public class SuggestSearchIT extends ESIntegTestCase {
}
public void testWithMultipleCommands() throws Exception {
createIndex("test");
assertAcked(prepareCreate("test").addMapping("typ1", "field1", "type=text", "field2", "type=text"));
ensureGreen();
index("test", "typ1", "1", "field1", "prefix_abcd", "field2", "prefix_efgh");