From 6c79569caef4ec6de992b4a6997b86ddbeb15662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BCscher?= Date: Wed, 8 Jul 2015 14:42:37 +0200 Subject: [PATCH] Replacing now unsupported dot-notation in object field mappings in base test setup We still want one mapping with an object with two inner fields for e.g. testing one code path in ExistsQueryBuilder. Using the dot notation for field names was forbidden with recent changes from master coming in. --- .../index/query/BaseQueryTestCase.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/core/src/test/java/org/elasticsearch/index/query/BaseQueryTestCase.java b/core/src/test/java/org/elasticsearch/index/query/BaseQueryTestCase.java index 77439fa020297..4459cf404122b 100644 --- a/core/src/test/java/org/elasticsearch/index/query/BaseQueryTestCase.java +++ b/core/src/test/java/org/elasticsearch/index/query/BaseQueryTestCase.java @@ -58,11 +58,20 @@ import org.elasticsearch.test.VersionUtils; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPoolModule; -import org.junit.*; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; import java.io.IOException; -import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.nullValue; @Ignore public abstract class BaseQueryTestCase> extends ElasticsearchTestCase { @@ -135,9 +144,11 @@ protected void configure() { DOUBLE_FIELD_NAME, "type=double", BOOLEAN_FIELD_NAME, "type=boolean", STRING_FIELD_NAME, "type=string", - OBJECT_FIELD_NAME, "type=object", - OBJECT_FIELD_NAME+"."+DATE_FIELD_NAME, "type=date", - OBJECT_FIELD_NAME+"."+INT_FIELD_NAME, "type=integer").string()), false, false); + OBJECT_FIELD_NAME, "type=object" + ).string()), false, false); + // also add mappings for two inner field in the object field + mapperService.merge(type, new CompressedXContent("{\"properties\":{\""+OBJECT_FIELD_NAME+"\":{\"type\":\"object\"," + + "\"properties\":{\""+DATE_FIELD_NAME+"\":{\"type\":\"date\"},\""+INT_FIELD_NAME+"\":{\"type\":\"integer\"}}}}}"), false, false); currentTypes[i] = type; } namedWriteableRegistry = injector.getInstance(NamedWriteableRegistry.class);