From 6f38a3a8a8b2b48ea9390113a610731a05e2802f Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Fri, 18 Jan 2013 16:09:24 +0100 Subject: [PATCH] create index and mapping first to ensure all relevant nodes see the mapping --- .../test/integration/mlt/MoreLikeThisActionTests.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/java/org/elasticsearch/test/integration/mlt/MoreLikeThisActionTests.java b/src/test/java/org/elasticsearch/test/integration/mlt/MoreLikeThisActionTests.java index c427ac526ce..5881cebe547 100644 --- a/src/test/java/org/elasticsearch/test/integration/mlt/MoreLikeThisActionTests.java +++ b/src/test/java/org/elasticsearch/test/integration/mlt/MoreLikeThisActionTests.java @@ -19,11 +19,14 @@ package org.elasticsearch.test.integration.mlt; +import java.util.Collections; + import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.client.Client; import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.indices.IndexMissingException; import org.elasticsearch.test.integration.AbstractNodesTests; import org.testng.annotations.AfterClass; @@ -164,6 +167,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()) .setRouting("2")