Ingest Node Processor

Hi all,
short question about the Processor.
I am using a processor called monthlyindex, with the following settings:

{
  "description": "monthly date-time index naming",
  "processors" : [
    {
      "date_index_name" : {
        "field" : "@timestamp",
        "index_name_prefix" : "anna-test-index-",
        "date_rounding" : "M",
		"index_name_format" : "YYYY.MM"
      }
    }
  ]
}

I am inserting documents to this a index with Java via:
IndexResponse response = client.prepareIndex("anna-test-index", "test").setSource(insertObject).setId("eins").setPipeline("monthlyindex").get();

As far as I can see the index for this month has been created automatically. But unfortunately I need a special index mapping for this index. Am I able to specify this mapping somehow in the processor? Or how can I do it?
I am using elasticsearch 5.2.2. :slight_smile:

Thanks in advance
Anna

Hi Anna,

You could use a template for index creation.

In your example it would look like this:

PUT _template/name_of_your_template
{
  "index_patterns": ["anna-test*"],
  "mappings": {
    "my-type": {
      "properties": {
        "age": {
          "type": "integer"
        }
      }
    }
  }
}

It means that all indices starting with "anna-test" will be created with that configuration.

Hope it helps,
LG

1 Like

Anna you should be using the Index Template feature as my colegue Luiz refered, but just keep in mind that the example he used is the syntax for 6.0. The syntax for Index Template for 5.x is slightly different, you should be using the attribute template instead of index_patterns (more details here)

1 Like

Thank you very much :blush:
Works like a charm!

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.