Is there a way to store the index name in the documents?
I have created an alias to search across three indexes. And, in some cases I would like to specify the index without changing the main api call.
I have updated the mappings for the index using:
{
"tweet" : {
"_index" : { "enabled" : true }
}
}
When I run the following query, nothing is returned. Is the index name not stored in the document?
{"filter":{"terms":{"_index":["tweet"]}},"query":{"match_all":{}}}
The index name should be stored with the documents, however according to this open issue it is not usable in terms queries (amongst other) yet. As a workaround you could try the Indices Query with only one index.
Thank you Christoph. When I tried the query against my alias, it says that the alias "has more than one indices associated with it" and it "can't execute a single index op"?
Sounds like you're trying to index into an alias, that doesn't work. If you have an alias test_indices for three indices i1, i2 and i3 then the following query only returns docs from one index:
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.