0

I am using Elasticsearch . I am trying to connect Elasticsearch with python.

I can create index with document. When i tried to fetch the same once successful creation done it returns empty.

If i make the code to sleep for 2 seconds after creating the data in Elasticsearch, then it returns actual data.

Is there any interval required to create and search the same data?

Sample code:

es_client.index(index=index_id, doc_type=doc_type, id=doc_id, body=body)

returns:
{'_index': 'account_001', '_type': 'UnitTest', '_id': '9f48ae128e4811e88c4b0242ac120013', '_version': 1, 'result': 'created', '_shards': {'total': 2, 'successful': 2, 'failed': 0}, 'created': True}

es_client.search(index=index_id, doc_type=doc_type, body=query, filter_path=filter_path)

returns {}
dbmitch
  • 5,361
  • 4
  • 24
  • 38
sangeeth kumar
  • 319
  • 2
  • 7
  • 23
  • 1
    this answer might help: https://stackoverflow.com/questions/42406674/elastic-search-get-doesnt-give-latest-document/42407323#42407323 – Val Jul 25 '18 at 05:13