How can I get the document meta data after saving a document in elasticsearch?

You can get the IDs as you bulk index documents:

for ok, document in streaming_bulk(client, actions=actions, index="test-index"):
    print(document["index"]["_id"])

Alternatively, you can specify the IDs you want for the documents yourself so you don't have to retrieve them after the fact. Here's an example of that with a custom iterable function:

1 Like