elastic4s search for id

Viewed 783

two questions regarding searching _id field:

  1. I want to find if specific id exists using elastic4s dsl. the aquivilent to this query elasticsearch API:

    curl -XGET 'http://localhost:9200/indexName/indexType/_search/exists?q=_id:foo'

I tried to do something like this :

 client execute search(indexName / indexType) query ("_id", "foo")

but this yields SearchDefinition which cannot be checked by isExists

  1. I want to fetch all _id's so far I got this solution but I am not sure that this is the idomatic way to do it

    client.execute(search(indexName / indexType) query "id").map(.ids)

1 Answers
Related