0

Using Elasticsearch 8.8

Im trying to use script pipeline to reindex documents, i will transform the old _type metadata into a new field '@type', but all scripts remove all _type and _score fields from the source of doc. There is a way to get the string for using to set the new field?

The main goal is a mega upgrade from elastic 2.4 to 8

Doc example:

{
  "_index": "foo",
  "_type": "bar",
  "_source": {
  }
}

Objective target:

{
  "_index": "foo",
  "_source": {
    "@type": "bar"
  }
}

Trying something like: ctx['@type'] = ctx._type Will return "null" because the _type is deleted before running anything. There is a workaround?

neus
  • 15
  • 2
  • 6

1 Answers1

0

As far as I know, it's not possible as in ES 8 the reindex context doesn't provide that information anymore. It used to be the case up until 6.8 before the removal of mapping types.

What you need to do is to first update your data in your 2.4 source cluster to add that field because 2.4 provide the ctx._type information and only then reindex to 8.9

Val
  • 207,596
  • 13
  • 358
  • 360