Use AsyncElasticsearch to perform a cross-index query and get a document

Question:

I use an AsyncElasticsearch client instance in order to retrieve a document from an Elasticsearch database:
doc = await client.get(index=some_index, id=some_id)

Documentation is here

The above is successful only when I query a specific index.
If I pass a pattern such as some_index* then it fails to return a document and instead I get a CORS error.

Answers:

One can not use a wildcard (*) when doing a GET by document _id. When requesting a document by _id you must provide the individual index (or alias).

Wildcards and cross-index operations can be used only when performing searches:
example: GET /index-pattern-*/_search

See here

Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.