diff --git a/src/plugins/kibana/public/settings/sections/indices/add_data_steps/pipeline_setup/directives/processor_ui.js b/src/plugins/kibana/public/settings/sections/indices/add_data_steps/pipeline_setup/directives/processor_ui.js
index 80c41ca10396..f56d757ceeae 100644
--- a/src/plugins/kibana/public/settings/sections/indices/add_data_steps/pipeline_setup/directives/processor_ui.js
+++ b/src/plugins/kibana/public/settings/sections/indices/add_data_steps/pipeline_setup/directives/processor_ui.js
@@ -1,3 +1,4 @@
import './processor_ui_container';
+import './processor_ui_append';
import './processor_ui_gsub';
import './processor_ui_set';
diff --git a/src/plugins/kibana/public/settings/sections/indices/add_data_steps/pipeline_setup/directives/processor_ui_append.js b/src/plugins/kibana/public/settings/sections/indices/add_data_steps/pipeline_setup/directives/processor_ui_append.js
new file mode 100644
index 000000000000..d1fcdaafbeda
--- /dev/null
+++ b/src/plugins/kibana/public/settings/sections/indices/add_data_steps/pipeline_setup/directives/processor_ui_append.js
@@ -0,0 +1,38 @@
+import uiModules from 'ui/modules';
+import template from '../views/processor_ui_append.html';
+
+const app = uiModules.get('kibana');
+
+//scope.processor, scope.pipeline are attached by the process_container.
+app.directive('processorUiAppend', function () {
+ return {
+ restrict: 'E',
+ template: template,
+ controller : function ($scope) {
+ const processor = $scope.processor;
+ const pipeline = $scope.pipeline;
+
+ function processorUiChanged() {
+ pipeline.setDirty();
+ }
+
+ function splitValues(delimitedList) {
+ return delimitedList.split('\n');
+ }
+
+ function joinValues(valueArray) {
+ return valueArray.join('\n');
+ }
+
+ function updateValues() {
+ processor.values = splitValues($scope.values);
+ }
+
+ $scope.values = joinValues(processor.values);
+
+ $scope.$watch('values', updateValues);
+ $scope.$watch('processor.targetField', processorUiChanged);
+ $scope.$watchCollection('processor.values', processorUiChanged);
+ }
+ };
+});
diff --git a/src/plugins/kibana/public/settings/sections/indices/add_data_steps/pipeline_setup/lib/processor_types.js b/src/plugins/kibana/public/settings/sections/indices/add_data_steps/pipeline_setup/lib/processor_types.js
index 751188e6691f..eaf67fd19e5c 100644
--- a/src/plugins/kibana/public/settings/sections/indices/add_data_steps/pipeline_setup/lib/processor_types.js
+++ b/src/plugins/kibana/public/settings/sections/indices/add_data_steps/pipeline_setup/lib/processor_types.js
@@ -39,7 +39,7 @@ export class Append extends Processor {
processorId: this.processorId,
typeId: this.typeId,
targetField: this.targetField || '',
- value: this.values || []
+ values: this.values || []
};
}
};
diff --git a/src/plugins/kibana/public/settings/sections/indices/add_data_steps/pipeline_setup/views/processor_ui_append.html b/src/plugins/kibana/public/settings/sections/indices/add_data_steps/pipeline_setup/views/processor_ui_append.html
new file mode 100644
index 000000000000..ce71ec5d1f0e
--- /dev/null
+++ b/src/plugins/kibana/public/settings/sections/indices/add_data_steps/pipeline_setup/views/processor_ui_append.html
@@ -0,0 +1,8 @@
+
+
+
+
+
+ (line delimited)
+
+
diff --git a/src/plugins/kibana/server/lib/converters/ingest_processor_api_kibana_to_es_converters.js b/src/plugins/kibana/server/lib/converters/ingest_processor_api_kibana_to_es_converters.js
index 817bcc7dda24..f2b623e24cb3 100644
--- a/src/plugins/kibana/server/lib/converters/ingest_processor_api_kibana_to_es_converters.js
+++ b/src/plugins/kibana/server/lib/converters/ingest_processor_api_kibana_to_es_converters.js
@@ -1,3 +1,13 @@
+export function append(processorApiDocument) {
+ return {
+ append: {
+ tag: processorApiDocument.processor_id,
+ field: processorApiDocument.target_field,
+ value: processorApiDocument.values
+ }
+ };
+}
+
export function gsub(processorApiDocument) {
return {
gsub: {
diff --git a/src/plugins/kibana/server/lib/schemas/resources/ingest_processor_schemas.js b/src/plugins/kibana/server/lib/schemas/resources/ingest_processor_schemas.js
index 1a255b6a48df..99b96094a466 100644
--- a/src/plugins/kibana/server/lib/schemas/resources/ingest_processor_schemas.js
+++ b/src/plugins/kibana/server/lib/schemas/resources/ingest_processor_schemas.js
@@ -4,6 +4,12 @@ const base = Joi.object({
processor_id: Joi.string().required()
});
+export const append = base.keys({
+ type_id: Joi.string().only('append').required(),
+ target_field: Joi.string().allow(''),
+ values: Joi.array().items(Joi.string().allow(''))
+});
+
export const gsub = base.keys({
type_id: Joi.string().only('gsub').required(),
source_field: Joi.string().allow(''),
diff --git a/test/unit/api/ingest/processors/_append.js b/test/unit/api/ingest/processors/_append.js
new file mode 100644
index 000000000000..238cac6b9ee2
--- /dev/null
+++ b/test/unit/api/ingest/processors/_append.js
@@ -0,0 +1,67 @@
+define(function (require) {
+ var Promise = require('bluebird');
+ var _ = require('intern/dojo/node!lodash');
+ var expect = require('intern/dojo/node!expect.js');
+
+ const testPipeline = {
+ processors: [{
+ processor_id: 'processor1',
+ type_id: 'append',
+ target_field: 'foo',
+ values: [ 'value1', 'value2' ]
+ }],
+ input: {}
+ };
+
+ return function (bdd, scenarioManager, request) {
+ bdd.describe('simulate - append processor', () => {
+
+ bdd.it('should return 400 for an invalid payload', () => {
+ return Promise.all([
+ // Append processor requires targetField property
+ request.post('/kibana/ingest/simulate')
+ .send({
+ input: {},
+ processors: [{
+ processor_id: 'processor1',
+ type_id: 'append',
+ values: [ 'value1', 'value2' ],
+ target_field: 42
+ }]
+ })
+ .expect(400)
+ ]);
+ });
+
+ bdd.it('should return 200 for a valid simulate request', () => {
+ return request.post('/kibana/ingest/simulate')
+ .send(testPipeline)
+ .expect(200);
+ });
+
+ bdd.it('should return a simulated output with the correct result for the given processor', () => {
+ return request.post('/kibana/ingest/simulate')
+ .send(testPipeline)
+ .expect(200)
+ .then(function (response) {
+ expect(response.body[0].output.foo).to.be.eql([ 'value1', 'value2' ]);
+ });
+ });
+
+ bdd.it('should enforce snake case', () => {
+ return request.post('/kibana/ingest/simulate')
+ .send({
+ processors: [{
+ processorId: 'processor1',
+ typeId: 'append',
+ targetField: 'foo',
+ value: [ 'value1', 'value2' ]
+ }],
+ input: {}
+ })
+ .expect(400);
+ });
+
+ });
+ };
+});
diff --git a/test/unit/api/ingest/processors/index.js b/test/unit/api/ingest/processors/index.js
index 87d130af1d96..f0daff68716d 100644
--- a/test/unit/api/ingest/processors/index.js
+++ b/test/unit/api/ingest/processors/index.js
@@ -1,10 +1,12 @@
define(function (require) {
var set = require('./_set');
var gsub = require('./_gsub');
+ var append = require('./_append');
return function processors(bdd, scenarioManager, request) {
set(bdd, scenarioManager, request);
gsub(bdd, scenarioManager, request);
+ append(bdd, scenarioManager, request);
};
});