I'm new to ES, so please bear with me while I explain what I'm trying to do.
I'm using ES version 1.5.2, and making use of the JAVA APIs via JEST wrapper. I would like to create some percolate queries and store them in the index.
I understand that there is special index called '_percolator' where I should store these queries, however, I can't seem to be able to create this index myself. Trying to store queries directly throws index does not exist error (on Searchly). In addition, I saw a slidedeck (https://speakerdeck.com/javanna/whats-new-in-percolator?#80) which seems to suggest to store the queries in an index called 'anyindex'
So, my questions are...
- Which index should the percolate queries be stored in (for ES 1.5.2)
- If its in the '_percolate', does this index have to be created explicitly?
- Should percolate queries be stored in the Index the same way as a document is? See snippet below.
This is how I tried storing a query using JEST;
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.query(QueryBuilders.matchQuery("stock", "apple"));
saveDoc(searchSourceBuilder, "company-apple", "_percolator", "stocks");
public JestResult saveDoc(Object doc, String docId, String indexName, String type) {
Index index = new Index.Builder(doc).id(docId).index(indexName).type(type).build();
return client.execute(index);
}
Thanks for your input and suggestions.
Raunak