Dynamic Index Creation based on document field

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):

Describe the issue:


I have below document:
{“transactionId”:“1234”,“transactionType”:“card”, “timestamp”: “2023-11-30T14:41:12”}

I want to insert this document in the index based on transactionType, for example above document will goto index payment_{transactionType}_{timestamp in date format} i.e., payment_card_2024-11-30

Please help here.


Relevant Logs or Screenshots:

You can use ingest pipeline to achieve that:

  1. Create a ingest pipeline named date-index-name
PUT _ingest/pipeline/date_index_name
  "processors": [
        "date_index_name": {
          "field": "timestamp",
          "date_rounding" : "d",
          "date_formats": ["yyyy-MM-dd'T'HH:mm:ss"]

  1. Index documents with the ingest pipeline
POST test1/_doc?pipeline=date_index_name
  "transactionId": "1234",
  "transactionType": "card",
  "timestamp": "2023-11-30T14:41:12"
  1. Check the index and document:

GET payment_card_2023-11-30/_search