Python helpers equivalent for java


#1

Hi all,
I'm new to elasticsearch. I'm facing issue when indexing with java APIs.

I'm able to index documents with '_id' field using helpers.bulk in python.
But when I'm trying to index the same with java API's I get this exception.

MapperParsingException[Field [_id] is a metadata field and cannot be added inside a document. Use the index API request parameters.]

Can you help sorting this out? Is there helpers equivalent for java?

Thanks in advance!


(David Pilato) #2

If you are using the java client, just read https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-docs-index.html#java-docs-index-doc


#3

Thank you for your reply. It looks helpers.bulk( ) internally extract _id field , where java client does not. So I passed _id to IndexRequest and removed _id from the document sent for bulk indexing.


(system) #4