Home > Back-end >  Use AsyncElasticsearch to perform a cross-index query and get a document
Use AsyncElasticsearch to perform a cross-index query and get a document

Time:01-31

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.

CodePudding user response:

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

  • Related