testMoreLikeThisIssue2197 should create index mapping first to prevent races

This commit is contained in:
Simon Willnauer 2013-01-18 16:41:37 +01:00
parent 6f38a3a8a8
commit c563248f76
1 changed files with 5 additions and 0 deletions

View File

@ -147,6 +147,11 @@ public class MoreLikeThisActionTests extends AbstractNodesTests {
client1.admin().indices().prepareDelete("foo").execute().actionGet();
} catch (IndexMissingException e) {
}
String mapping = XContentFactory.jsonBuilder().startObject().startObject("bar")
.startObject("properties")
.endObject()
.endObject().endObject().string();
client1.admin().indices().prepareCreate("foo").addMapping("bar", mapping).execute().actionGet();
client1.prepareIndex("foo", "bar", "1")
.setSource(jsonBuilder().startObject().startObject("foo").field("bar", "boz").endObject())
.execute().actionGet();