Reputation: 21449
I am using Tire gem as an elasticsearch client.
I wanted to know if there is a way to know if the document with known id exists in the index?
something like:
Tire.exists? { index: 'myIndex', type: 'myType', id: 'myId' }
Upvotes: 0
Views: 237
Reputation: 3792
Please try this,
Tire::Configuration.client.get "#{Tire::Configuration.url}/myindex/mytype/myid?pretty"
If the document exists then returns the document with indexed properties or else the response body contains
{
"exists" : false
}
Upvotes: 0