-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Null pointer exception using Global Aggregation and then Nested Aggregation #27928
Description
Elasticsearch version (bin/elasticsearch --version): 5.1.2
Plugins installed: []
JVM version (java -version):
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
OS version (uname -a if on a Unix-like system):
Linux xxxx 2.6.32-642.el6.x86_64 #1 SMP Tue May 10 17:27:01 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Description of the problem including expected versus actual behavior:
I just make a query with some filters and retrieve the corresponding documents. Also, I try to add aggregations about these documents with a NestedAggregation and without any filter used in the query so I used at the very beginning the GlobalAggregation.
When I make the request I get a Null Pointer exception from elastic log. However, I get results from aggregations but also, an error.
Request:
{
"query": {
"bool": {
"filter": [
{
"bool": {
"must": [
{
"nested": {
"path": "attributes",
"query": {
"bool": {
"must": [
{
"nested": {
"path": "attributes.value",
"query": {
"term": {
"attributes.value.group_value": "4"
}
}
}
},
{
"term": {
"attributes.id": "2"
}
}
]
}
}
}
},
{
"nested": {
"path": "path",
"query": {
"term": {
"path.id_category": "1"
}
}
}
}
]
}
}
]
}
},
"aggregations": {
"all_wine_types": {
"global": {},
"aggregations": {
"all_wine_types": {
"nested": {
"path": "attributes"
},
"aggregations": {
"all_wine_types": {
"filter": {
"term": {
"attributes.id": "2"
}
},
"aggregations": {
"all_wine_type_values": {
"nested": {
"path": "attributes.value"
},
"aggregations": {
"wine_type_value": {
"terms": {
"field": "attributes.value.group_value"
},
"aggregations": {
"data": {
"reverse_nested": {},
"aggregations": {
"data": {
"top_hits": {
"size": 1,
"_source": {
"includes": [
"attributes"
]
}
}
}
}
},
"root_data": {
"reverse_nested": {},
"aggregations": {
"data": {
"top_hits": {
"size": 1,
"_source": {
"includes": [
"path"
]
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
},
"size": 0
}
Response:
{
"took": 45,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 4,
"failed": 1,
"failures": [
{
"shard": 4,
"index": "xxxxx",
"node": "4__8482PTbacWtnUnX4d8g",
"reason": {
"type": "null_pointer_exception",
"reason": null
}
}
]
},
"hits": {
"total": 18544,
"max_score": 0,
"hits": []
},
Steps to reproduce:
No steps!
Provide logs (if relevant):
2017-12-20T15:54:54,361][DEBUG][o.e.a.s.TransportSearchAction] [4__8482] [xxxxx][4], node[4__8482PTbacWtnUnX4d8g], [P], s[STARTED], a[id=LOwrt7QKRK6bdrhhakAkRg]: Failed to execute [SearchRequest{searchType=QUERY_THEN_FETCH, indices=[xxxxx], indicesOptions=IndicesOptions[id=38, ignore_unavailable=false, allow_no_indices=true, expand_wildcards_open=true, expand_wildcards_closed=false, allow_alisases_to_multiple_indices=true, forbid_closed_indices=true], types=[product], routing='null', preference='null', requestCache=null, scroll=null, source={
"size" : 0,
"query" : {
"bool" : {
"filter" : [
{
"bool" : {
"must" : [
{
"nested" : {
"query" : {
"bool" : {
"must" : [
{
"nested" : {
"query" : {
"term" : {
"attributes.value.group_value" : {
"value" : "4",
"boost" : 1.0
}
}
},
"path" : "attributes.value",
"ignore_unmapped" : false,
"score_mode" : "avg",
"boost" : 1.0
}
},
{
"term" : {
"attributes.id" : {
"value" : "2",
"boost" : 1.0
}
}
}
],
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
"path" : "attributes",
"ignore_unmapped" : false,
"score_mode" : "avg",
"boost" : 1.0
}
},
{
"nested" : {
"query" : {
"term" : {
"path.id_category" : {
"value" : "1",
"boost" : 1.0
}
}
},
"path" : "path",
"ignore_unmapped" : false,
"score_mode" : "avg",
"boost" : 1.0
}
}
],
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
}
],
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
"aggregations" : {
"all_wine_types" : {
"global" : { },
"aggregations" : {
"all_wine_types" : {
"nested" : {
"path" : "attributes"
},
"aggregations" : {
"all_wine_types" : {
"filter" : {
"term" : {
"attributes.id" : {
"value" : "2",
"boost" : 1.0
}
}
},
"aggregations" : {
"all_wine_type_values" : {
"nested" : {
"path" : "attributes.value"
},
"aggregations" : {
"wine_type_value" : {
"terms" : {
"field" : "attributes.value.group_value",
"size" : 10,
"shard_size" : -1,
"min_doc_count" : 1,
"shard_min_doc_count" : 0,
"show_term_doc_count_error" : false,
"order" : [
{
"_count" : "desc"
},
{
"_term" : "asc"
}
]
},
"aggregations" : {
"data" : {
"reverse_nested" : { },
"aggregations" : {
"data" : {
"top_hits" : {
"from" : 0,
"size" : 1,
"version" : false,
"explain" : false,
"_source" : {
"includes" : [
"attributes"
],
"excludes" : [ ]
}
}
}
}
},
"root_data" : {
"reverse_nested" : { },
"aggregations" : {
"data" : {
"top_hits" : {
"from" : 0,
"size" : 1,
"version" : false,
"explain" : false,
"_source" : {
"includes" : [
"path"
],
"excludes" : [ ]
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
},
"ext" : { }
}}]
org.elasticsearch.transport.RemoteTransportException: [4__8482][192.168.1.12:9300][indices:data/read/search[phase/query]]
Caused by: java.lang.NullPointerException
Thank you so much!