hasParentFilter not working in SearchScrollRequestBuilder in v0.90.10


(Sandeep Jain) #1

Hi,

After version upgrading to 0.90.10, I am facing a issue in
SearchScrollRequestBuilder when query having parent filters, the response
having the following failure message:

{
"took" : 45,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 0,
"failed" : 1,
"failures" : [ {
"index" : "12345",
"shard" : 1,
"status" : 500,
"reason" :
"RemoteTransportException[[Americop][inet[/10.0.0.5:9300]][search/phase/scan/scroll]];
nested: QueryPhaseExecutionException[[12345][1]:
query[ConstantScore(cache(_type:CTable))],from[0],size[10000]: Query Failed
[Failed to execute main query]]; nested: NullPointerException; "
} ]
},
"hits" : {
"total" : 1,
"max_score" : 0.0,
"hits" : [ ]
}
}

the same request working successfully via SearchRequestBuilder or REST.

Am I missing something as it was running fine in version 0.90.5 ?

To reproduce the same :

curl -XPOST 'http://localhost:9200/12345'

curl -XPUT 'http://localhost:9200/12345/PTable/row1?routing=12345' -d '{
"user" : "dev-elasticsearch",
"post_date" : "2014-01-12",
"message" : "search with hasParentFilter in scroll not working"
}'

Run the following code :
public static void main(String[] args) {
Client client = NodeBuilder.nodeBuilder().node().client();
/*
PutMappingRequestBuilder pmrb = client.admin().indices()
.preparePutMapping("12345").setType("CTable");

pmrb.setSource("{"CTable":{"_parent":{"type":"PTable"},"_routing":{"required":true}}}");
pmrb.execute().actionGet();
IndexRequestBuilder irb = new IndexRequestBuilder(client);
irb.setIndex("12345");
irb.setType("CTable");
irb.setId("childRow1");
irb.setRouting("12345");
irb.setParent("row1");
Map<String, Object> data = new HashMap<String, Object>();
data.put("col1", "val1");
irb.setSource(data);
irb.execute().actionGet();*/

    SearchRequestBuilder searchRequestBuilder = new 

SearchRequestBuilder(
client);
searchRequestBuilder.setIndices("12345");
searchRequestBuilder.setTypes("CTable");
searchRequestBuilder.setRouting("12345");
FilterBuilder postFilter = FilterBuilders.hasParentFilter("PTable",
FilterBuilders.termFilter("user", "elasticsearch"));
searchRequestBuilder.setPostFilter(postFilter);
searchRequestBuilder.addField("col1");
searchRequestBuilder.setScroll("5m");
searchRequestBuilder.setSearchType(SearchType.SCAN);
searchRequestBuilder.setSize(10000);
SearchResponse sr = searchRequestBuilder.execute().actionGet();

    String scrollId = sr.getScrollId();
    SearchScrollRequestBuilder searchScrollRequestBuilder = new 

SearchScrollRequestBuilder(
client);
searchScrollRequestBuilder.setScrollId(scrollId);
SearchResponse searchScrollResponse = searchScrollRequestBuilder
.execute().actionGet();
ClearScrollRequestBuilder clearScrollRequestBuilder = new
ClearScrollRequestBuilder(
client);
clearScrollRequestBuilder.addScrollId(scrollId);
boolean isCleared = clearScrollRequestBuilder.execute().actionGet()
.isSucceeded();
System.out.println(searchScrollResponse.getShardFailures());
}

Thanks

--
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/1652d726-6e9e-4e91-a222-a06128182a8a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Reelsen) #2

Hey,

when you run NodeBuilder.nodeBuilder().node().client() - you are actually
starting another elasticsearch instance. Is that intended?
Why are returining JSON data, when executing java classes (I am a bit
confused).

Can you create a gist, which only contains curl calls or only contains a
Java API in order to rule out you run two different instances? Thanks!

--Alex

On Sun, Jan 12, 2014 at 5:51 AM, Sandeep Jain sandy6jain@gmail.com wrote:

Hi,

After version upgrading to 0.90.10, I am facing a issue in
SearchScrollRequestBuilder when query having parent filters, the response
having the following failure message:

{
"took" : 45,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 0,
"failed" : 1,
"failures" : [ {
"index" : "12345",
"shard" : 1,
"status" : 500,
"reason" : "RemoteTransportException[[Americop][inet[/10.0.0.5:9300]][search/phase/scan/scroll]];
nested: QueryPhaseExecutionException[[12345][1]:
query[ConstantScore(cache(_type:CTable))],from[0],size[10000]: Query Failed
[Failed to execute main query]]; nested: NullPointerException; "
} ]
},
"hits" : {
"total" : 1,
"max_score" : 0.0,
"hits" : [ ]
}
}

the same request working successfully via SearchRequestBuilder or REST.

Am I missing something as it was running fine in version 0.90.5 ?

To reproduce the same :

curl -XPOST 'http://localhost:9200/12345'

curl -XPUT 'http://localhost:9200/12345/PTable/row1?routing=12345' -d '{
"user" : "dev-elasticsearch",
"post_date" : "2014-01-12",
"message" : "search with hasParentFilter in scroll not working"
}'

Run the following code :
public static void main(String[] args) {
Client client = NodeBuilder.nodeBuilder().node().client();
/*
PutMappingRequestBuilder pmrb = client.admin().indices()
.preparePutMapping("12345").setType("CTable");

pmrb.setSource("{"CTable":{"_parent":{"type":"PTable"},"_routing":{"required":true}}}");
pmrb.execute().actionGet();
IndexRequestBuilder irb = new IndexRequestBuilder(client);
irb.setIndex("12345");
irb.setType("CTable");
irb.setId("childRow1");
irb.setRouting("12345");
irb.setParent("row1");
Map<String, Object> data = new HashMap<String, Object>();
data.put("col1", "val1");
irb.setSource(data);
irb.execute().actionGet();*/

    SearchRequestBuilder searchRequestBuilder = new

SearchRequestBuilder(
client);
searchRequestBuilder.setIndices("12345");
searchRequestBuilder.setTypes("CTable");
searchRequestBuilder.setRouting("12345");
FilterBuilder postFilter = FilterBuilders.hasParentFilter("PTable",
FilterBuilders.termFilter("user", "elasticsearch"));
searchRequestBuilder.setPostFilter(postFilter);
searchRequestBuilder.addField("col1");
searchRequestBuilder.setScroll("5m");
searchRequestBuilder.setSearchType(SearchType.SCAN);
searchRequestBuilder.setSize(10000);
SearchResponse sr = searchRequestBuilder.execute().actionGet();

    String scrollId = sr.getScrollId();
    SearchScrollRequestBuilder searchScrollRequestBuilder = new

SearchScrollRequestBuilder(
client);
searchScrollRequestBuilder.setScrollId(scrollId);
SearchResponse searchScrollResponse = searchScrollRequestBuilder
.execute().actionGet();
ClearScrollRequestBuilder clearScrollRequestBuilder = new
ClearScrollRequestBuilder(
client);
clearScrollRequestBuilder.addScrollId(scrollId);
boolean isCleared = clearScrollRequestBuilder.execute().actionGet()
.isSucceeded();
System.out.println(searchScrollResponse.getShardFailures());
}

Thanks

--
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/1652d726-6e9e-4e91-a222-a06128182a8a%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/CAGCwEM_A7N%3DjvUQANxOnPOZ%3Dy%3D5u%2BoQUMBhfU1NoUMvFETd9Qg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Sandeep Jain) #3

Hi Alex,

I configured client as true in classpath & having a static node instance in
my app, so not creating instance on each query.
I had created gist for the same: https://gist.github.com/sandy6jain/8421029

Thanks

On Tuesday, January 14, 2014 3:53:17 AM UTC-8, Alexander Reelsen wrote:

Hey,

when you run NodeBuilder.nodeBuilder().node().client() - you are actually
starting another elasticsearch instance. Is that intended?
Why are returining JSON data, when executing java classes (I am a bit
confused).

Can you create a gist, which only contains curl calls or only contains a
Java API in order to rule out you run two different instances? Thanks!

--Alex

On Sun, Jan 12, 2014 at 5:51 AM, Sandeep Jain <sandy...@gmail.com<javascript:>

wrote:

Hi,

After version upgrading to 0.90.10, I am facing a issue in
SearchScrollRequestBuilder when query having parent filters, the response
having the following failure message:

{
"took" : 45,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 0,
"failed" : 1,
"failures" : [ {
"index" : "12345",
"shard" : 1,
"status" : 500,
"reason" :
"RemoteTransportException[[Americop][inet[/10.0.0.5:9300]][search/phase/scan/scroll]];
nested: QueryPhaseExecutionException[[12345][1]:
query[ConstantScore(cache(_type:CTable))],from[0],size[10000]: Query Failed
[Failed to execute main query]]; nested: NullPointerException; "
} ]
},
"hits" : {
"total" : 1,
"max_score" : 0.0,
"hits" : [ ]
}
}

the same request working successfully via SearchRequestBuilder or REST.

Am I missing something as it was running fine in version 0.90.5 ?

To reproduce the same :

curl -XPOST 'http://localhost:9200/12345'

curl -XPUT 'http://localhost:9200/12345/PTable/row1?routing=12345' -d '{
"user" : "dev-elasticsearch",
"post_date" : "2014-01-12",
"message" : "search with hasParentFilter in scroll not working"
}'

Run the following code :
public static void main(String[] args) {
Client client = NodeBuilder.nodeBuilder().node().client();
/*
PutMappingRequestBuilder pmrb = client.admin().indices()
.preparePutMapping("12345").setType("CTable");

pmrb.setSource("{"CTable":{"_parent":{"type":"PTable"},"_routing":{"required":true}}}");
pmrb.execute().actionGet();
IndexRequestBuilder irb = new IndexRequestBuilder(client);
irb.setIndex("12345");
irb.setType("CTable");
irb.setId("childRow1");
irb.setRouting("12345");
irb.setParent("row1");
Map<String, Object> data = new HashMap<String, Object>();
data.put("col1", "val1");
irb.setSource(data);
irb.execute().actionGet();*/

    SearchRequestBuilder searchRequestBuilder = new 

SearchRequestBuilder(
client);
searchRequestBuilder.setIndices("12345");
searchRequestBuilder.setTypes("CTable");
searchRequestBuilder.setRouting("12345");
FilterBuilder postFilter =
FilterBuilders.hasParentFilter("PTable",
FilterBuilders.termFilter("user", "elasticsearch"));
searchRequestBuilder.setPostFilter(postFilter);
searchRequestBuilder.addField("col1");
searchRequestBuilder.setScroll("5m");
searchRequestBuilder.setSearchType(SearchType.SCAN);
searchRequestBuilder.setSize(10000);
SearchResponse sr = searchRequestBuilder.execute().actionGet();

    String scrollId = sr.getScrollId();
    SearchScrollRequestBuilder searchScrollRequestBuilder = new 

SearchScrollRequestBuilder(
client);
searchScrollRequestBuilder.setScrollId(scrollId);
SearchResponse searchScrollResponse = searchScrollRequestBuilder
.execute().actionGet();
ClearScrollRequestBuilder clearScrollRequestBuilder = new
ClearScrollRequestBuilder(
client);
clearScrollRequestBuilder.addScrollId(scrollId);
boolean isCleared =
clearScrollRequestBuilder.execute().actionGet()
.isSucceeded();
System.out.println(searchScrollResponse.getShardFailures());
}

Thanks

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/1652d726-6e9e-4e91-a222-a06128182a8a%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/bd95101e-9107-4958-a832-2c9f25af3c4d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Dan Everton) #4

This looks similar to this
bug https://github.com/elasticsearch/elasticsearch/issues/4703 thought
that's with has_child filters and doesn't throw an error. I wonder if it's
a related issue though?

There's both curl and JUnit test cases attached there if that helps.

Cheers,
Dan

--
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/fd4e6e2b-5341-4865-953a-d76666ffba0a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #5