Skip to content

Commit

Permalink
Omit _type from response if not present in request
Browse files Browse the repository at this point in the history
  • Loading branch information
gwbrown committed Jan 29, 2019
1 parent 5d8cacd commit 7a3a08c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ private static List<IngestDocument> parseDocs(Map<String, Object> config) {
deprecationLogger.deprecatedAndMaybeLog("type_in_pipeline_simulation",
"Specifying _type in pipeline simulation requests is deprecated.");
}
String type = ConfigurationUtils.readStringOrIntProperty(null, null,
dataMap, MetaData.TYPE.getFieldName(), "_type");
String type = (String) dataMap.get(MetaData.TYPE.getFieldName());
String id = ConfigurationUtils.readStringOrIntProperty(null, null,
dataMap, MetaData.ID.getFieldName(), "_id");
String routing = ConfigurationUtils.readOptionalStringOrIntProperty(null, null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.elasticsearch.ingest.TestProcessor;
import org.elasticsearch.test.ESTestCase;
import org.junit.Before;
import org.junit.BeforeClass;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -97,8 +96,6 @@ public void testParseUsingPipelineStore() throws Exception {
expectedDoc.put(INDEX.getFieldName(), index);
if (useExplicitType) {
expectedDoc.put(TYPE.getFieldName(), type);
} else {
expectedDoc.put(TYPE.getFieldName(), "_type");
}
expectedDoc.put(ID.getFieldName(), id);
expectedDoc.put(Fields.SOURCE, Collections.singletonMap(fieldName, fieldValue));
Expand Down Expand Up @@ -155,8 +152,6 @@ public void testParseWithProvidedPipeline() throws Exception {
String value = randomAlphaOfLengthBetween(1, 10);
doc.put(field.getFieldName(), value);
expectedDoc.put(field.getFieldName(), value);
} else {
expectedDoc.put(field.getFieldName(), "_type");
}
} else {
if (randomBoolean()) {
Expand Down

0 comments on commit 7a3a08c

Please sign in to comment.