# Shard failure when scrolling - invalid results, but no error reported

**URL:** https://discuss.elastic.co/t/shard-failure-when-scrolling-invalid-results-but-no-error-reported/18158
**Category:** Elasticsearch
**Created:** [June 17, 2014, 3:03pm UTC](https://discuss.elastic.co/t/shard-failure-when-scrolling-invalid-results-but-no-error-reported/18158 "2014-06-17T15:03:34Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mooky](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@mooky](https://discuss.elastic.co/u/mooky)
#### Post date: [June 17, 2014, 3:03pm UTC](https://discuss.elastic.co/t/shard-failure-when-scrolling-invalid-results-but-no-error-reported/18158/1 "2014-06-17T15:03:34Z")

</div>

I have been having some problem with a failing test (using the  
ElasticsearchIntegrationTest) that was testing scrolling.  
It took quite a while to notice that in my response was an indication I was  
getting a shard failure (my search response was OK, but the response  
included shard failures).  
I strongly suspect this is why I am not getting the results I expect from  
the scroll (ie no results, totalHits=0)

When I dump the search response, I get a bit of a cryptic (at least for me)  
message and I can't figure out what the cause is:  
e.g.

{  
"\_scroll\_id" : "c2NhbjswOzE7dG90YWxfaGl0czoxOw==",  
"took" : 11,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 10,  
"successful" : 9,  
"failed" : 1,  
"failures" : [ {  
"index" : "logistics",  
"shard" : 8,  
"status" : 500,  
"reason" : "QueryPhaseExecutionException[[logistics][8]:  
query[+ConstantScore(cache(\_type:quota))  
+(groupCompanyId:582D1EE6CDF54510AAA7CC2AA635F31B)  
+\_all:cancelled\*],from[0],size[500]: Query Failed [Failed to execute main  
query]]; nested: AssertionError; "  
} ]  
},  
"hits" : {  
"total" : 1000,  
"max\_score" : 0.0,  
"hits" : []  
}  
}

1. I would have expected this error to manifest itself in the form of an  
exception (java api) rather than having to inspect shard failures manually  
(given the impact on the results).  
I have seen all shards fail, but still no error reported. Is this expected?

2. How can I get a full stack trace of the error related to the shard  
failure? "nested: AssertionError;" is teasing me with the fact that there  
_is_ more info, but its being kept from me.

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/023bdc12-6e6a-4bd2-a357-f8419cb4a403%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/023bdc12-6e6a-4bd2-a357-f8419cb4a403%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![mooky](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@mooky](https://discuss.elastic.co/u/mooky)
#### Post date: [June 17, 2014, 3:12pm UTC](https://discuss.elastic.co/t/shard-failure-when-scrolling-invalid-results-but-no-error-reported/18158/2 "2014-06-17T15:12:32Z")

</div>

With a bit of cunning use of the debugger, I managed to get the stacktrace  
that was lost.  
It appears that maybe the ElasticsearchIntegrationTest environment is the  
cause...  
This looks like a bug?

java.lang.AssertionError  
at org.elasticsearch.common.util.BigArrays$LongArrayWrapper.get(BigArrays.  
java:200)  
at org.elasticsearch.test.cache.recycler.MockBigArrays$LongArrayWrapper.get  
(MockBigArrays.java:374)  
at org.elasticsearch.common.util.BytesRefHash.get(BytesRefHash.java:66)  
at org.elasticsearch.common.util.BytesRefHash.set(BytesRefHash.java:101)  
at org.elasticsearch.common.util.BytesRefHash.add(BytesRefHash.java:145)  
at org.elasticsearch.search.aggregations.bucket.terms.  
StringTermsAggregator$WithOrdinals.collect(StringTermsAggregator.java:299)  
at org.elasticsearch.search.aggregations.  
AggregationPhase$AggregationsCollector.collect(AggregationPhase.java:164)  
at org.elasticsearch.common.lucene.MultiCollector.collect(MultiCollector.  
java:60)  
at org.apache.lucene.search.Scorer.score(Scorer.java:65)  
at org.apache.lucene.search.AssertingScorer.score(AssertingScorer.java:136)  
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:621)  
at org.elasticsearch.search.internal.ContextIndexSearcher.search(  
ContextIndexSearcher.java:173)  
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:491)  
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:448)  
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:281)  
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:269)  
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:123)  
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.  
java:282)  
at org.elasticsearch.search.action.SearchServiceTransportAction.  
sendExecuteQuery(SearchServiceTransportAction.java:270)  
at org.elasticsearch.action.search.type.  
TransportSearchScrollQueryThenFetchAction$AsyncAction.executeQueryPhase(  
TransportSearchScrollQueryThenFetchAction.java:200)  
at org.elasticsearch.action.search.type.  
TransportSearchScrollQueryThenFetchAction$AsyncAction.access$600(  
TransportSearchScrollQueryThenFetchAction.java:75)  
at org.elasticsearch.action.search.type.  
TransportSearchScrollQueryThenFetchAction$AsyncAction$2.run(  
TransportSearchScrollQueryThenFetchAction.java:184)  
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(  
ThreadPoolExecutor.java:886)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.  
java:908)  
at java.lang.Thread.run(Thread.java:662)

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4ed29d05-f287-44ff-ba83-f690b71fae1d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4ed29d05-f287-44ff-ba83-f690b71fae1d%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 1:21am UTC](https://discuss.elastic.co/t/shard-failure-when-scrolling-invalid-results-but-no-error-reported/18158/3 "2017-07-06T01:21:47Z")

</div>


