summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch/index/mapper/IdFieldMapperTests.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test/java/org/elasticsearch/index/mapper/IdFieldMapperTests.java')
-rw-r--r--core/src/test/java/org/elasticsearch/index/mapper/IdFieldMapperTests.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/src/test/java/org/elasticsearch/index/mapper/IdFieldMapperTests.java b/core/src/test/java/org/elasticsearch/index/mapper/IdFieldMapperTests.java
index 55b6e7bf71..b7ad6a7e4c 100644
--- a/core/src/test/java/org/elasticsearch/index/mapper/IdFieldMapperTests.java
+++ b/core/src/test/java/org/elasticsearch/index/mapper/IdFieldMapperTests.java
@@ -21,6 +21,7 @@ package org.elasticsearch.index.mapper;
import org.elasticsearch.common.compress.CompressedXContent;
import org.elasticsearch.common.xcontent.XContentFactory;
+import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.IdFieldMapper;
import org.elasticsearch.index.mapper.MapperParsingException;
@@ -33,7 +34,7 @@ import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
public class IdFieldMapperTests extends ESSingleNodeTestCase {
-
+
public void testId() throws Exception {
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.endObject().endObject().string();
@@ -54,7 +55,7 @@ public class IdFieldMapperTests extends ESSingleNodeTestCase {
try {
docMapper.parse(SourceToParse.source("test", "type", "1", XContentFactory.jsonBuilder()
- .startObject().field("_id", "1").endObject().bytes()));
+ .startObject().field("_id", "1").endObject().bytes(), XContentType.JSON));
fail("Expected failure to parse metadata field");
} catch (MapperParsingException e) {
assertTrue(e.getMessage(), e.getMessage().contains("Field [_id] is a metadata field and cannot be added inside a document"));