Skip to content

Missing bwc java.time layer for 6.8 date_index_name ingest processor #58481

@pgomulka

Description

@pgomulka

looks like #34507 was not backported to 6.8
it was meant to be fixed by this #37407 but it missed IndexNameExpresionResolver class. It only fixed this in DateFormat (used by when creating an index name expression, but not resolving. This is used during simulate and on 'phase1' ingestion with index name processor)
it is not possible to use date formats with 8 prefix in date_index_name ingest processors
this works in simulate but does not work with ingest
steps to reproduce

curl --request PUT \
  --url http://localhost:9200/_ingest/pipeline/index_name \
  --header 'authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' \
  --header 'content-type: application/json' \
  --data '{
  "description": "Pipeline for routing data to specific index",
  "processors": [
    {
      "date_index_name": {
        "field": "my_timestamp",
        "date_rounding": "d",
        "index_name_prefix": "x-",
        "index_name_format": "8YYYY-w"
      }
    }
  ]
}'

simulate - ok

curl --request POST \
  --url http://localhost:9200/_ingest/pipeline/_simulate \
  --header 'authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' \
  --header 'content-type: application/json' \
  --data '{
  "pipeline": {
    "processors": [
      {
        "pipeline": {
          "name": "index_name"
        }
      }
    ]
  },
  "docs": [
    {
      "_source": {
 				 "my_timestamp": "2020-08-10T01:01:01.000Z"
      }
    }
  ]
}'

simulate result:

{
  "docs": [
    {
      "doc": {
        "_index": "<x-{2020-33||/d{8YYYY-w|UTC}}>",
        "_type": "_type",
        "_id": "_id",
        "_source": {
          "my_timestamp": "2020-08-10T01:01:01.000Z"
        },
        "_ingest": {
          "timestamp": "2020-06-24T10:53:08.433437Z"
        }
      }
    }
  ]
}

ingestion fail

curl --request PUT \
  --url 'http://localhost:9200/test1/_doc/1?pipeline=index_name' \
  --header 'authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' \
  --header 'content-type: application/json' \
  --data '{
  "my_timestamp": "2020-08-10T01:01:01.000Z"
}'

ingestion failure result

{
  "error": {
    "root_cause": [
      {
        "type": "parse_exception",
        "reason": "failed to parse date field [2020-33] with format [8YYYY-w]"
      }
    ],
    "type": "parse_exception",
    "reason": "failed to parse date field [2020-33] with format [8YYYY-w]",
    "caused_by": {
      "type": "illegal_argument_exception",
      "reason": "Parse failure at index [0] of [2020-33]"
    }
  },
  "status": 400
}

it works with joda

curl --request PUT \
  --url http://localhost:9200/_ingest/pipeline/index_name \
  --header 'authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' \
  --header 'content-type: application/json' \
  --data '{
  "description": "Pipeline for routing data to specific index",
  "processors": [
    {
      "date_index_name": {
        "field": "my_timestamp",
        "date_rounding": "d",
        "index_name_prefix": "x-",
        "index_name_format": "xxxx-w"
      }
    }
  ]
}'

simulate

curl --request POST \
  --url http://localhost:9200/_ingest/pipeline/_simulate \
  --header 'authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' \
  --header 'content-type: application/json' \
  --data '{
  "pipeline": {
    "processors": [
      {
        "pipeline": {
          "name": "index_name"
        }
      }
    ]
  },
  "docs": [
    {
      "_source": {
 				 "my_timestamp": "2020-08-10T01:01:01.000Z"
      }
    }
  ]
}'

ingestion ok

curl --request PUT \
  --url 'http://localhost:9200/test1/_doc/1?pipeline=index_name' \
  --header 'authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' \
  --header 'content-type: application/json' \
  --data '{
  "my_timestamp": "2020-08-10T01:01:01.000Z"
}'

result

{
  "_index": "x-2020-33",
  "_type": "_doc",
  "_id": "1",
  "_version": 1,
  "result": "created",
  "_shards": {
    "total": 2,
    "successful": 1,
    "failed": 0
  },
  "_seq_no": 0,
  "_primary_term": 1
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Core/Infra/CoreCore issues without another label:Data Management/Ingest NodeExecution or management of Ingest Pipelines including GeoIP>bugTeam:Core/InfraMeta label for core/infra teamTeam:Data ManagementMeta label for data/management teamneeds:triageRequires assignment of a team area label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions