0

I have been trying to do a bulk index in the elasticsearch 8.x using this:

from elasticsearch.helpers import bulk as bulk_indexer

success, failed = bulk_indexer(self.es_client, actions, stats_only=True, chunk_size=900)

Apparently i am seeing :

RuntimeError: elasticsearch.BadRequestError: BadRequestError(400, 'illegal_argument_exception', 'Action/metadata line [1] contains an unknown parameter [_type]') [while running 'bulk index']

I came to know about https://www.elastic.co/guide/en/elasticsearch/reference/7.17/removal-of-types.html

and i think this is the reason for it , but can someone help me to know why i am seeing this or what could be the issue?

I tried to migrate from es 5 to es 8.x

Ricko
  • 9
  • 2
  • What version is your Python client library? – Val Nov 08 '22 at 12:58
  • @Val : both my python lib and cluster are at 8.3.3 – Ricko Nov 08 '22 at 13:02
  • You probably need to show how your `bulk_indexer` function is implemented – Val Nov 08 '22 at 13:04
  • @Val I am using the elasticsearch.helper i.e `from elasticsearch.helpers import bulk` – Ricko Nov 08 '22 at 13:07
  • Fair enough I didn't see the alias, then can you show how your `actions` look like? – Val Nov 08 '22 at 13:22
  • ah okay , yes let me try to find since the action comes via a Kafka read operation after a bunch of transformation. Meanwhile i get the action (it will probabbly take a me a while) , does this error somehow says that somewhere in the action there might be a `_type` ? – Ricko Nov 08 '22 at 13:40

1 Answers1

0

There must be a _type in the action command line that shouldn't be there anymore. If those records have been stored in Kafka in earlier versions of ES and you're replaying them, or if the client application still produces those action records with the same logic, then you either need to change that producing logic and/or post-process those records in your bulk indexer to remove the _type field.

Val
  • 207,596
  • 13
  • 358
  • 360