elasticsearch - Search multiple indices for an ID efficiently? -
i need document have no idea index in. have bunch of indices different days; prefixed "mydocs-". i've tried:
get /mydocs-*/adoc/my_second_doc returns "index_not_found_exception" /mydocs-*/adoc/_search { "query": { "bool":{ "filter": [{ "term":{ "_id": ["my_second_doc"] } }] } } } returns docs in index.
now, if search specific index can doc. problem don't know index in beforehand. so, i'd have search many, many indices (thousands of indices).
get /mydocs-12/adoc/my_second_doc
returns desired doc.
any ideas on how efficient get/search doc?
have tried :
get mydocs-*/adoc/_search { "query": { "term": { "_id": "my_second_doc" } } }
or more :
get mydocs-*/_search { "query": { "bool": { "must": [ { "term": { "_id": "my_second_doc" } }, { "term": { "_type": "adoc" } } ] } } }
the above 2 queries find documents index
starting mydocs-
, type
adoc
, id
my_second_doc
.
Comments
Post a Comment