From 92ab44d35c5d6027364c288796cf4a4990cd3569 Mon Sep 17 00:00:00 2001 From: Tal Levy Date: Wed, 28 Sep 2016 23:04:22 +0200 Subject: [PATCH] [fix] JSON Processor was not properly added (#20613) --- .../ingest/common/IngestCommonPlugin.java | 1 + .../rest-api-spec/test/ingest/10_basic.yaml | 19 ++++----- .../rest-api-spec/test/ingest/140_json.yaml | 40 +++++++++++++++++++ 3 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/140_json.yaml diff --git a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/IngestCommonPlugin.java b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/IngestCommonPlugin.java index e6948771d8d..82d316dfa62 100644 --- a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/IngestCommonPlugin.java +++ b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/IngestCommonPlugin.java @@ -62,6 +62,7 @@ public class IngestCommonPlugin extends Plugin implements IngestPlugin { processors.put(GrokProcessor.TYPE, new GrokProcessor.Factory(builtinPatterns)); processors.put(ScriptProcessor.TYPE, new ScriptProcessor.Factory(parameters.scriptService)); processors.put(DotExpanderProcessor.TYPE, new DotExpanderProcessor.Factory()); + processors.put(JsonProcessor.TYPE, new JsonProcessor.Factory()); return Collections.unmodifiableMap(processors); } diff --git a/modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/10_basic.yaml b/modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/10_basic.yaml index e37b2d83183..87c1f5a8abf 100644 --- a/modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/10_basic.yaml +++ b/modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/10_basic.yaml @@ -19,12 +19,13 @@ - match: { nodes.$master.ingest.processors.7.type: grok } - match: { nodes.$master.ingest.processors.8.type: gsub } - match: { nodes.$master.ingest.processors.9.type: join } - - match: { nodes.$master.ingest.processors.10.type: lowercase } - - match: { nodes.$master.ingest.processors.11.type: remove } - - match: { nodes.$master.ingest.processors.12.type: rename } - - match: { nodes.$master.ingest.processors.13.type: script } - - match: { nodes.$master.ingest.processors.14.type: set } - - match: { nodes.$master.ingest.processors.15.type: sort } - - match: { nodes.$master.ingest.processors.16.type: split } - - match: { nodes.$master.ingest.processors.17.type: trim } - - match: { nodes.$master.ingest.processors.18.type: uppercase } + - match: { nodes.$master.ingest.processors.10.type: json } + - match: { nodes.$master.ingest.processors.11.type: lowercase } + - match: { nodes.$master.ingest.processors.12.type: remove } + - match: { nodes.$master.ingest.processors.13.type: rename } + - match: { nodes.$master.ingest.processors.14.type: script } + - match: { nodes.$master.ingest.processors.15.type: set } + - match: { nodes.$master.ingest.processors.16.type: sort } + - match: { nodes.$master.ingest.processors.17.type: split } + - match: { nodes.$master.ingest.processors.18.type: trim } + - match: { nodes.$master.ingest.processors.19.type: uppercase } diff --git a/modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/140_json.yaml b/modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/140_json.yaml new file mode 100644 index 00000000000..3d9f6a97c08 --- /dev/null +++ b/modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/140_json.yaml @@ -0,0 +1,40 @@ +--- +teardown: + - do: + ingest.delete_pipeline: + id: "1" + ignore: 404 + +--- +"Test JSON Processor": + - do: + ingest.put_pipeline: + id: "1" + body: > + { + "processors": [ + { + "json" : { + "field" : "foo" + } + } + ] + } + - match: { acknowledged: true } + + - do: + index: + index: test + type: test + id: 1 + pipeline: "1" + body: { + foo: "{\"hello\": \"world\"}" + } + + - do: + get: + index: test + type: test + id: 1 + - match: { _source.foo.hello: "world" }