My Java code isn't giving me percolation matches, but when I use the REST
API after indexing is done, I can see there are percolation matches.
My java pseudo code is showing below.
My percolating code is right after I add a document to BulkProcessor for
indexing. Percolation response never gets any results. What am I missing?
//createIndex ...
//Register Percolator
QueryBuilder qb = QueryBuilders.matchQuery("content", "taxes");
client.prepareIndex(index, ".percolator", "harkinQuery")
.setSource(jsonBuilder()
.startObject()
.field("query", qb) // Register the query
.endObject())
.setRefresh(true) // Needed when the query shall be available immediately
.execute().actionGet();
//index with BulkProcessor
void addDocsToBulk(){
for(i=0; i< numDocs; i++)
{
JSONObject jDoc = getDoc[i];
//add the doc to bulk processor
//Percolate
PercolateResponse response = client.preparePercolate()
.setIndices("index")
.setDocumentType("type")
.setSource(jDoc.toString()).execute().actionGet();
//Iterate over the results
for(PercolateResponse.Match match : response) {
//Handle the result which is the name of
//the query in the percolator
}
Any ideas why the percolator isn't showing me matches while indexing in
Transport java client, but shows fine after indexing process is done by
REST query command like so:
On Wednesday, September 3, 2014 6:54:20 PM UTC-4, IronMan2014 wrote:
My Java code isn't giving me percolation matches, but when I use the REST
API after indexing is done, I can see there are percolation matches.
My java pseudo code is showing below.
My percolating code is right after I add a document to BulkProcessor for
indexing. Percolation response never gets any results. What am I missing?
//createIndex ...
//Register Percolator
QueryBuilder qb = QueryBuilders.matchQuery("content", "taxes");
client.prepareIndex(index, ".percolator", "harkinQuery")
.setSource(jsonBuilder()
.startObject()
.field("query", qb) // Register the query
.endObject())
.setRefresh(true) // Needed when the query shall be available immediately
.execute().actionGet();
//index with BulkProcessor
void addDocsToBulk(){
for(i=0; i< numDocs; i++)
{
JSONObject jDoc = getDoc[i];
//add the doc to bulk processor
//Percolate
PercolateResponse response = client.preparePercolate()
.setIndices("index")
.setDocumentType("type")
.setSource(jDoc.toString()).execute().actionGet();
//Iterate over the results
for(PercolateResponse.Match match : response) {
//Handle the result which is the name of
//the query in the percolator
}
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.