Skip to content

Commit 02bd04d

Browse files
committed
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.
1 parent c4c4bb1 commit 02bd04d

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

core/src/test/java/org/elasticsearch/index/query/BaseQueryTestCase.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,20 @@
5858
import org.elasticsearch.test.VersionUtils;
5959
import org.elasticsearch.threadpool.ThreadPool;
6060
import org.elasticsearch.threadpool.ThreadPoolModule;
61-
import org.junit.*;
61+
import org.junit.After;
62+
import org.junit.AfterClass;
63+
import org.junit.Before;
64+
import org.junit.BeforeClass;
65+
import org.junit.Ignore;
66+
import org.junit.Test;
6267

6368
import java.io.IOException;
6469

65-
import static org.hamcrest.Matchers.*;
70+
import static org.hamcrest.Matchers.equalTo;
71+
import static org.hamcrest.Matchers.instanceOf;
72+
import static org.hamcrest.Matchers.is;
73+
import static org.hamcrest.Matchers.notNullValue;
74+
import static org.hamcrest.Matchers.nullValue;
6675

6776
@Ignore
6877
public abstract class BaseQueryTestCase<QB extends AbstractQueryBuilder<QB>> extends ElasticsearchTestCase {
@@ -135,9 +144,11 @@ protected void configure() {
135144
DOUBLE_FIELD_NAME, "type=double",
136145
BOOLEAN_FIELD_NAME, "type=boolean",
137146
STRING_FIELD_NAME, "type=string",
138-
OBJECT_FIELD_NAME, "type=object",
139-
OBJECT_FIELD_NAME+"."+DATE_FIELD_NAME, "type=date",
140-
OBJECT_FIELD_NAME+"."+INT_FIELD_NAME, "type=integer").string()), false, false);
147+
OBJECT_FIELD_NAME, "type=object"
148+
).string()), false, false);
149+
// also add mappings for two inner field in the object field
150+
mapperService.merge(type, new CompressedXContent("{\"properties\":{\""+OBJECT_FIELD_NAME+"\":{\"type\":\"object\","
151+
+ "\"properties\":{\""+DATE_FIELD_NAME+"\":{\"type\":\"date\"},\""+INT_FIELD_NAME+"\":{\"type\":\"integer\"}}}}}"), false, false);
141152
currentTypes[i] = type;
142153
}
143154
namedWriteableRegistry = injector.getInstance(NamedWriteableRegistry.class);

0 commit comments

Comments
 (0)