Is it possible to request a single document by its id by querying an alias, provided that all keys across all indices in the alias are unique (it is an external guarantee)?
You use GET to retrieve a document and its source or stored fields from a particular index. Use HEAD to verify that a document exists. You can use the _source resource retrieve just the document source or verify that it exists.
Elasticsearch will get significant slower if you just add some big number as size, one method to use to get all documents is using scan and scroll ids. The results from this would contain a _scroll_id which you have to query to get the next 100 chunk. This answer needs more updates. search_type=scan is now deprecated.
It is an URL-safe, Base64-encoded GUID generated using modified FlakeID algorithm. FlakeID is a decentralized algorithm that generates k-ordered unique IDs. Note that Elasticsearch does not generate the _id using the random UUIDs anymore.
This request gets the document with id 2, but it is routed based on the user. The document is not fetched if the correct routing is not specified.
Yes, querying an alias spanning over multiple indices work the same way as querying one indice. POST my_alias_name/_search { "filter": { "term": {"_id": "AUwNrOZsm6BwwrmnodbW"} } }
In case you want to find a document with some internal id with curl: Following Elasticsearch 8.2 Doc, you can retrieve a single document by using GET API:
In case you want to find a document with some internal id with curl:
curl -X GET 'localhost:9200/_search?q=id:42&pretty'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With