avoid stripping out _source prefix when in _ingest context
This commit is contained in:
parent
57d6971252
commit
a95f81c015
|
@ -467,12 +467,12 @@ public final class IngestDocument {
|
|||
newPath = path.substring(8, path.length());
|
||||
} else {
|
||||
initialContext = sourceAndMetadata;
|
||||
newPath = path;
|
||||
if (path.startsWith("_source.")) {
|
||||
newPath = path.substring(8, path.length());
|
||||
} else {
|
||||
newPath = path;
|
||||
}
|
||||
}
|
||||
if (newPath.startsWith("_source.")) {
|
||||
newPath = newPath.substring(8, path.length());
|
||||
}
|
||||
|
||||
this.pathElements = Strings.splitStringToArray(newPath, '.');
|
||||
if (pathElements.length == 0) {
|
||||
throw new IllegalArgumentException("path [" + path + "] is not valid");
|
||||
|
|
|
@ -366,6 +366,12 @@ public class IngestDocumentTests extends ESTestCase {
|
|||
assertThat(ingestDocument.getSourceAndMetadata().get("_ingest"), equalTo("value"));
|
||||
}
|
||||
|
||||
public void testSetIngestSourceObject() {
|
||||
//test that we don't strip out the _source prefix when _ingest is used
|
||||
ingestDocument.setFieldValue("_ingest._source", "value");
|
||||
assertThat(ingestDocument.getIngestMetadata().get("_source"), equalTo("value"));
|
||||
}
|
||||
|
||||
public void testSetEmptyPathAfterStrippingOutPrefix() {
|
||||
try {
|
||||
ingestDocument.setFieldValue("_source.", "value");
|
||||
|
|
Loading…
Reference in New Issue