(no subject)

I am working with percolate . Here is what I am doing

QueryBuilder qb = termQuery("content", "amazing");

client.prepareIndex("percator", "myType", "kuku")
.setSource(qb.toString())
.setRefresh(true)
.execute().actionGet();

With above code it creates an index name percator
Now I want to send document so that it matches the query

XContentBuilder docBuilder = XContentFactory.jsonBuilder().startObject();

docBuilder.field("doc").startObject();
docBuilder.field("content","amazing");
docBuilder.endObject();
docBuilder.endObject();

PercolateResponse response =client.preparePercolate("percator",
"myType").setSource(docBuilder).execute().actionGet();
but the response get the 0 results what I am doing wrong

You just defined a percolator.
You must put then documents in your index.

See Elasticsearch Platform — Find real-time answers at scale | Elastic

HTH
David :wink:
@dadoonet

Le 28 févr. 2012 à 08:01, jajoria abhishek jajoria.abhishek@gmail.com a écrit :

I am working with percolate . Here is what I am doing

QueryBuilder qb = termQuery("content", "amazing");

client.prepareIndex("percator", "myType", "kuku")
.setSource(qb.toString())
.setRefresh(true)
.execute().actionGet();

With above code it creates an index name percator
Now I want to send document so that it matches the query

XContentBuilder docBuilder = XContentFactory.jsonBuilder().startObject();

docBuilder.field("doc").startObject();
docBuilder.field("content","amazing");
docBuilder.endObject();
docBuilder.endObject();

PercolateResponse response =client.preparePercolate("percator", "myType").setSource(docBuilder).execute().actionGet();
but the response get the 0 results what I am doing wrong

Why do you call toString on the query builder?

On Tuesday, February 28, 2012 at 9:01 AM, jajoria abhishek wrote:

I am working with percolate . Here is what I am doing

QueryBuilder qb = termQuery("content", "amazing");

client.prepareIndex("percator", "myType", "kuku")
.setSource(qb.toString())
.setRefresh(true)
.execute().actionGet();

With above code it creates an index name percator
Now I want to send document so that it matches the query

XContentBuilder docBuilder = XContentFactory.jsonBuilder().startObject();

docBuilder.field("doc").startObject();
docBuilder.field("content","amazing");
docBuilder.endObject();
docBuilder.endObject();

PercolateResponse response =client.preparePercolate("percator", "myType").setSource(docBuilder).execute().actionGet();
but the response get the 0 results what I am doing wrong

Sir with this method

client.prepareIndex("_percolator", "myIndexName", "myDesignatedQueryName")
.setSource(qb)
.setRefresh(true) //Needed when the query shall be available immediately
.execute().actionGet();

IT shows error in setSource() as no suitable method found for
setSource(org.elasticsearch.index.query.QueryBuilder)

On Wed, Feb 29, 2012 at 7:19 PM, Shay Banon kimchy@gmail.com wrote:

Why do you call toString on the query builder?

On Tuesday, February 28, 2012 at 9:01 AM, jajoria abhishek wrote:

I am working with percolate . Here is what I am doing

QueryBuilder qb = termQuery("content", "amazing");

client.prepareIndex("percator", "myType", "kuku")
.setSource(qb.toString())
.setRefresh(true)
.execute().actionGet();

With above code it creates an index name percator
Now I want to send document so that it matches the query

XContentBuilder docBuilder = XContentFactory.jsonBuilder().startObject();

docBuilder.field("doc").startObject();
docBuilder.field("content","amazing");
docBuilder.endObject();
docBuilder.endObject();

PercolateResponse response =client.preparePercolate("percator",
"myType").setSource(docBuilder).execute().actionGet();
but the response get the 0 results what I am doing wrong

Here is a sample of how you can use the Java API to do percolation: https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/integration/percolator/SimplePercolatorTests.java#L81.

On Thursday, March 1, 2012 at 2:02 PM, jajoria abhishek wrote:

Sir with this method
client.prepareIndex("_percolator", "myIndexName", "myDesignatedQueryName")
.setSource(qb)
.setRefresh(true) //Needed when the query shall be available immediately
.execute().actionGet(); IT shows error in setSource() as no suitable method found for setSource(org.elasticsearch.index.query.QueryBuilder)

On Wed, Feb 29, 2012 at 7:19 PM, Shay Banon <kimchy@gmail.com (mailto:kimchy@gmail.com)> wrote:

Why do you call toString on the query builder?

On Tuesday, February 28, 2012 at 9:01 AM, jajoria abhishek wrote:

I am working with percolate . Here is what I am doing

QueryBuilder qb = termQuery("content", "amazing");

client.prepareIndex("percator", "myType", "kuku")
.setSource(qb.toString())
.setRefresh(true)
.execute().actionGet();

With above code it creates an index name percator
Now I want to send document so that it matches the query

XContentBuilder docBuilder = XContentFactory.jsonBuilder().startObject();

docBuilder.field("doc").startObject();
docBuilder.field("content","amazing");
docBuilder.endObject();
docBuilder.endObject();

PercolateResponse response =client.preparePercolate("percator", "myType").setSource(docBuilder).execute().actionGet();
but the response get the 0 results what I am doing wrong