-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
Description
Elasticsearch version (bin/elasticsearch --version): 6.2.4
Plugins installed: []
JVM version (java -version):
OS version (uname -a if on a Unix-like system): docker image
Description of the problem including expected versus actual behavior:
If range query is using non-existing field, other_bucket will never be generated in result.
And the equivalent query_string seems working without problem.
Even worse, when using multi-index search, it may lead to Array IndexOutOfBoundsException exception
Steps to reproduce:
PUT test1/_doc/1
{
"n": 15
}
PUT test2/_doc/1
{
"m": 15
}
POST test1/_search
{
"size": 0,
"aggs": {
"test_other_bucket": {
"filters": {
"other_bucket": true,
"filters": {
"all": {
"match_all": {}
},
"query_string": {
"query_string": {
"query": "m:[10 TO 20]"
}
},
"use_range": {
"range": {
"m": {
"gte": 10,
"lte": 20
}
}
}
}
}
}
}
}
POST test1/_search
{
"size": 0,
"aggs": {
"test_other_bucket": {
"filters": {
"other_bucket": true,
"filters": {
"all": {
"match_all": {}
},
"query_string": {
"query_string": {
"query": "m:[10 TO 20]"
}
}
}
}
}
}
}
POST test2/_search
{
"size": 0,
"aggs": {
"test_other_bucket": {
"filters": {
"other_bucket": true,
"filters": {
"all": {
"match_all": {}
},
"query_string": {
"query_string": {
"query": "m:[10 TO 20]"
}
},
"use_range": {
"range": {
"m": {
"gte": 10,
"lte": 20
}
}
}
}
}
}
}
}
POST test*/_search
{
"size": 0,
"aggs": {
"test_other_bucket": {
"filters": {
"other_bucket": true,
"filters": {
"all": {
"match_all": {}
},
"query_string": {
"query_string": {
"query": "m:[10 TO 20]"
}
},
"use_range": {
"range": {
"m": {
"gte": 10,
"lte": 20
}
}
}
}
}
}
}
}
Provide logs (if relevant):
[2018-08-14T07:59:14,013][WARN ][r.suppressed ] path: /test*/_search, params: {index=test*}
org.elasticsearch.action.search.SearchPhaseExecutionException:
at org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseFailure(AbstractSearchAsyncAction.java:274) [elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.action.search.FetchSearchPhase$1.onFailure(FetchSearchPhase.java:92) [elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.onFailure(ThreadContext.java:657) [elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:39) [elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:41) [elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.2.4.jar:6.2.4]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_161]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_161]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_161]
Caused by: java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
at java.util.ArrayList.rangeCheck(ArrayList.java:657) ~[?:1.8.0_161]
at java.util.ArrayList.get(ArrayList.java:433) ~[?:1.8.0_161]
at org.elasticsearch.search.aggregations.bucket.filter.InternalFilters.doReduce(InternalFilters.java:221) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.search.aggregations.InternalAggregation.reduce(InternalAggregation.java:136) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.search.aggregations.InternalAggregations.reduce(InternalAggregations.java:77) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.action.search.SearchPhaseController.reduceAggs(SearchPhaseController.java:527) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.action.search.SearchPhaseController.reducedQueryPhase(SearchPhaseController.java:504) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.action.search.SearchPhaseController.reducedQueryPhase(SearchPhaseController.java:421) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.action.search.SearchPhaseController$1.reduce(SearchPhaseController.java:740) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.action.search.FetchSearchPhase.innerRun(FetchSearchPhase.java:102) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.action.search.FetchSearchPhase.access$000(FetchSearchPhase.java:45) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.action.search.FetchSearchPhase$1.doRun(FetchSearchPhase.java:87) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:672) ~[elasticsearch-6.2.4.jar:6.2.4]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.2.4.jar:6.2.4]
... 5 more