Percolation when Indexing


(IronMike) #1

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

bulkProcessor.add(Requests.indexRequest(index).type(type).id(jDoc.
getString("id")).source(jDoc.toString()));

//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
}

}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/2952b537-6784-43ad-9642-df6652de4479%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(IronMike) #2

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:

GET /myIndex/type/1232/_percolate
"matches": [
{
"_index": "myIndex",
"_id": "appealQuery"
},
{
"_index": "myIndex",
"_id": "harkinQuery"
}

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

bulkProcessor.add(Requests.indexRequest(index).type(type).id(jDoc.
getString("id")).source(jDoc.toString()));

//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
}

}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/285d71ae-40e9-40d7-b7cc-f598bc55263a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3