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.
In some places, I see a syntax which suggests I can store percolate queries in any index, but the type has to be of type '.percolator'. In other places, I've seen that the queries need to be stored in a special index called '_percolator'.
- Where should percolate queries be stored?
- Should the queries be saved in the index like a regular document is?
Below is a snippet of code which i tried, but it doesn't work.
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);
}