Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ingest] Creates the simulate api route #6121

Merged

Conversation

BigFunger
Copy link
Contributor

Replaces #6071 (1 of 3)
Creates the server-side functionality for node ingest simulate.

  • Adds keysDeep function and tests
    • keysDeep flattens a nested object into a list of properties
    • Uses dot notation for properties
    • Arrays are not exploded
  • adds 'set' ingest_processor_type
    • initial processor type to demonstrate the structure of a processor type
  • adds /api/kibana/ingest/simulate route
    • POST action endpoint
    • accepts a populated pipeline and returns a set of results for each processor in the submitted pipeline
  • adds ingest_simulate module and tests. The module contains two functions.
    • buildRequest packages pipeline into a format that elasticsearch expects
    • processResponse prepares a response for each processor in the submitted pipeline

Pipeline

The simulate route expects a form payload of a pipeline object in JSON.

{
  input: {}, //the sample object that will be the input for the first processor in the pipeline
  processors : [ /* an array of processor objects. There structure is defined below */ ]
}

Processor

The pipeline object contains an array of one or more processor objects.

{
  processorId: 'processor1', //this is a string that uniquely identifies the processor in the pipeline
  typeId: 'set', //this is a string that matches the typeId of it's processor_type object.
  ... //the processor can have any number of other properties that are important for that processor type more information in the processor type section.
}

Processor Type

The processor types are a co-ordinate scope collection. The client will instantiate an instance of a processor_type to create a Processor object. Each processor type will contain the common structure shown below along with default values for any properties that are important for that processor type. For example, a 'set' processor type needs to know the name of the field that is going to be added 'targetField' and the value of that new field 'value'. The 'split' processor on the other hand needs a 'sourceField' property that holds the name of an existing field, and a 'separator' property that will be used to split the value of the sourceField.

{
  typeId: 'set', //this is a unique value that identifies the processor type. This will also be used by the client to determine the directive name to render the corresponding ui.
  title: 'Set', //this is the user-friendly title for the processor type. This is used in any messaging to the user in the ui.
  getDefinition: function(processor) { ... }, //takes a processor that is an instance of that processor type and generating an object representation of that processor in the format that elasticsearch expects. ***
  getDescription: function(processor) { ... } //takes a processor that is an instance of this processor type and generates a string that is a quick summary of the action that processor is taking. This is used in the title-bar of the processor in the ui.
}

*** It is important that each property of a processor type that is used in getDefinition be set to a value in the processor type. Failing to do so will cause unexpected results in the ui.

@Bargs
Copy link
Contributor

Bargs commented Feb 8, 2016

API document needs to be snake cased to follow Kibana API conventions as discussed in #5429.

@Bargs
Copy link
Contributor

Bargs commented Feb 8, 2016

@BigFunger were you using Postman while developing this, and if so do you happen to have a collection of examples you could share via the share link functionality in Postman?

@Bargs Bargs mentioned this pull request Feb 12, 2016
15 tasks
@Bargs
Copy link
Contributor

Bargs commented Mar 2, 2016

Waiting on feedback here: BigFunger#6

@BigFunger
Copy link
Contributor Author

Bargs pushed a commit that referenced this pull request Mar 9, 2016
[ingest] Creates the simulate api route
@Bargs Bargs merged commit 4d7b468 into elastic:feature/ingest Mar 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants