Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[MHxs9PqFTq6ctF_g15Tneg][guba][2]: #8084

Closed
linhaobuaa opened this issue Oct 15, 2014 · 7 comments

Comments

@linhaobuaa
Copy link

1、GET guba/_search

{
"took": 3,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 2,
"failed": 0
},
"hits": {
"total": 135592,
"max_score": 1,
"hits": [
{
"_index": "guba",
"_type": "post",
"_id": "125570200",
"_score": 1,
"_source": {
"stockholder": false,
"stock_id": "600010",
"user_url": "http://iguba.eastmoney.com/9926113891298328",
"post_id": 125570200,
"url": "http://guba.eastmoney.com/news,600010,125570200,d.html",
"lastReplyTime": null,
"content": "买入 738381 买入价格99.00 买入股数 2",
"user_name": "赚够一千万123",
"title": "应",
"em_info": null,
"_id": 125570200,
"replies": 0,
"clicks": 342,
"first_in": 1413097216.340654,
"user_id": 9926113891298328,
"releaseTime": "2014-10-12 11:14:00",
"last_modify": 1413097216.340654,
"stock_name": "包钢股份"
}
}
]
}

2、
GET guba/_search
{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {}
}
},
"aggs": {
"range": {
"date_range": {
"field": "releaseTime",
"format": "yyyy-MM-dd H:M:s",
"ranges": [
{
"to": "2014-10-14 10:30:00"
},
{
"from": "2014-10-14 10:00:00"
}
]
}
}
}
}

{
"error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[MHxs9PqFTq6ctF_g15Tneg][guba][2]: ClassCastException[org.elasticsearch.index.fielddata.plain.PagedBytesIndexFieldData cannot be cast to org.elasticsearch.index.fielddata.IndexNumericFieldData]}{[MHxs9PqFTq6ctF_g15Tneg][guba][0]: ClassCastException[org.elasticsearch.index.fielddata.plain.PagedBytesIndexFieldData cannot be cast to org.elasticsearch.index.fielddata.IndexNumericFieldData]}]",
"status": 500
}

@clintongormley
Copy link
Contributor

Hi @linhaobuaa

It looks like you have two fields with the same name date_range in two types in the same index, which have different mappings: one is a date, and one is a string. This will not be allowed in the future (see #4081) for exactly the reasons that you reported.

Please reopen if the issue is not as I have described it.

@keertirastogi
Copy link

Hi,

Am new to elastic search and getting same error while creating a complex filter query. It would be great if somebody could look into this and help.

  1. GET /devices/app_89/_search?pretty=true
    {
    "took" : 313,
    "timed_out" : false,
    "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
    },
    "hits" : {
    "total" : 2,
    "max_score" : 1.0,
    "hits" : [ {
    "_index" : "devices",
    "_type" : "app_89",
    "_id" : "dev_5794712",
    "_score" : 1.0, "_source" : {"id":5794712,"app_id":89,"platform":{"id":2,"name":"iOS"},"UDID":null,"token":"APA91bEQ2XCyCwZxq3MU_IgQ7gNqpDyzjxqqPqHgaRk-8_jqUzOYweBMwIRW8L04xsuHS2oaMjr313oCW6Tgd61uSDHZavCqJ4W4GuFVFt2xnCxdqoFc1qTvhuGW1R9JoRNrVwKG0PhvsHMeJhJsUDnvWAs5A","disabled":0,"active":1,"push_disabled":0,"time_zone":2,"username":null,"dev_name":"GT-I9300","language":"English","country":"Spain","model":"GT-I9300","version":"Android 4.3(API level: 18)","sdk_version":null,"bundle_version":null,"badge":0,"created":"2015-01-29T14:19:43.000Z","sandbox":0,"disabled_date":null,"locations":{"last":{"gpt":{"lat":12.345346,"lon":12.345346},"dt":"2015-01-20T14:19:43.000Z"},"work":{"gpt":{"lat":12.345346,"lon":12.345346},"dt":"2015-01-20T14:19:43.000Z"},"home":{"gpt":{"lat":12.345346,"lon":12.345346},"dt":"2015-01-20T14:19:43.000Z"},"list":[{"gpt":{"lat":12.345346,"lon":12.345346},"dt":"2015-01-20T14:19:43.000Z"},{"gpt":{"lat":12.345346,"lon":12.345346},"dt":"2015-01-20T14:19:43.000Z"}]},"pushes":{"total_push":8,"openedCount":5,"last_push":null,"sent_list":[2352345,234,234234,2341,546,4534,464,657],"open_list":[2352345,234,234234,2341,546]},"sessions":{"morning_opens":1,"afternoon_opens":1,"evening_opens":3,"last_open":"2015-01-20T14:19:43.000Z","time_in_app":87,"total_sessions":2,"list":[{"datetime":"2015-01-20T14:19:43.000Z","length":256,"pushID":546},{"datetime":"2015-01-20T14:19:43.000Z","length":256,"pushID":546}]}}
    }, {
    "_index" : "devices",
    "_type" : "app_89",
    "_id" : "dev_5794711",
    "_score" : 1.0, "_source" : {"id":5794711,"app_id":89,"platform":{"id":1,"name":"android"},"UDID":null,"token":"APA91bEQ2XCyCwZxq3MU_IgQ7gNqpDyzjxqqPqHHmqJngaRk-8_jqUzOYweBMwIRW8L04xsuHS2oaMjr313oCW6Tgd61uSDHZavCqJ4W4GuFVFt2xnCxdqoFc1qTvhuGW1R9JoRNrVwKG0PhvsHMeJhJsUDnvWAs5A","disabled":0,"active":0,"push_disabled":0,"time_zone":2,"username":null,"dev_name":"GT-I9300","language":"Spanish","country":"Spain","model":"GT-I9300","version":"Android 4.3(API level: 18)","sdk_version":null,"bundle_version":null,"badge":0,"created":"2015-01-20T14:19:43.000Z","sandbox":0,"disabled_date":null,"locations":{"last":{"gpt":{"lat":12.345346,"lon":12.345346},"dt":"2015-01-20T14:19:43.000Z"},"work":{"gpt":{"lat":12.345346,"lon":12.345346},"dt":"2015-01-20T14:19:43.000Z"},"home":{"gpt":{"lat":12.345346,"lon":12.345346},"dt":"2015-01-20T14:19:43.000Z"},"list":[{"gpt":{"lat":12.345346,"lon":12.345346},"dt":"2015-01-20T14:19:43.000Z"},{"gpt":{"lat":12.345346,"lon":12.345346},"dt":"2015-01-20T14:19:43.000Z"}]},"pushes":{"total_push":8,"openedCount":5,"last_push":null,"sent_list":[2352345,234,234234,2341,546,4534,464,657],"open_list":[2352345,234,234234,2341,546]},"sessions":{"morning_opens":1,"afternoon_opens":1,"evening_opens":3,"last_open":"2015-01-20T14:19:43.000Z","time_in_app":87,"total_sessions":2,"list":[{"datetime":"2015-01-20T14:19:43.000Z","length":256,"pushID":546},{"datetime":"2015-01-20T14:19:43.000Z","length":256,"pushID":546}]}}
    } ]
    }
    }

Now my query url is : /devices/app_89/_search?pretty=true&search_type=count
And JSON query array is :
{
"aggs": {
"device_counts": {
"query" : {
"filtered" : {
"filter" : {
"bool" : {
"must_not" : [
{ "term" : {"token" : null }}
],
"must": [
{"term" : {"push_disabled" : "0" }},
{"term" : {"disabled" : "0" }},
{"term" : {"app_id" : <any_value> }}
],
"should" : [
{"term" : {"sandbox" : <any_value>}},
{"bool" : {
"must" : [
{"term" : {"platform_id" : 2}},
{"term" : {"sandbox" : 0}}
]
}}
]
}
}
}
},
"aggs": {
"platform_counts": {
"terms": {"field":"platform.name"}
}
}
}
}
}

Basically am trying to get document counts based on all the platforms found, including filters like - ( TOKEN!=null AND DISABLED=0 AND PUSH_DISABLED=0 AND APP_ID="<any_value>" AND (SANDBOX=<any_value> OR (PLATFORM_ID=2 AND SANDBOX=0)) )

Without including all the query filters, I am able to get the document counts correctly by this query -
{
"aggs": {
"device_counts": {
"filter": {
"bool": {
"must": [
{"term":{"active":"1"}},
{"term":{"disabled":"0"}}
]
}
},
"aggs": {
"platform_counts": {
"terms": {"field":"platform.name"}
}
}
}
}
}

Thanks in advance !

@keertirastogi
Copy link

Got that fixed yesterday, by just replacing null with this - '', in must_not filter. Like this -
{
.
.
.
"must_not" : [
{ "term" : {"token" : '' }}
],
.
.
.
}

@axper
Copy link

axper commented May 21, 2015

For me this issue was caused by not having enough disk space.
So if anyone is having this issue, check that the partition elastic is running on has enough free space and also check that you have enough RAM.

@rohitkothari
Copy link

@axper I also faced the same problem and it was caused by not having enough disk space. I have free'd enough disk space, but don't know how to change the health status from 'red' to 'green'. Do you have any idea?

@IvRRimum
Copy link

@rohitkothari You remember what was the problem ? I am stuck on here right now too ( using aws )

@MitheshReddyB
Copy link

"SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[ckJNQA6mS9yC1SnQppBxXw][logstash-2018.04.17][0]: SearchParseException[[logstash-2018.04.17][0]: from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"bool":{"filter":[{"range":{"@timestamp":{"gte":"1525757645955","lte":"1525779245955","format":"epoch_millis"}}},{"query_string":{"analyze_wildcard":true,"query":""}}]}},"aggs":{"2":{"date_histogram":{"interval":"30s","field":"@timestamp","min_doc_count":0,"extended_bounds":{"min":"1525757645955","max":"1525779245955"},"format":"epoch_millis"},"aggs":{}}}}]]]; nested: QueryParsingException[[logstash-2018.04.17] bool query does not support [filter]]; }{[ckJNQA6mS9yC1SnQppBxXw][logstash-2018.04.17][1]: SearchParseException[[logstash-2018.04.17][1]: from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"bool":{"filter":[{"range":{"@timestamp":{"gte":"1525757645955","lte":"1525779245955","format":"epoch_millis"}}},{"query_string":{"analyze_wildcard":true,"query":""}}]}},"aggs":{"2":{"date_histogram":{"interval":"30s","field":"@timestamp","min_doc_count":0,"extended_bounds":{"min":"1525757645955","max":"1525779245955"},"format":"epoch_millis"},"aggs":{}}}}]]]; nested: QueryParsingException[[logstash-2018.04.17] bool query does not support [filter]]; }{[ckJNQA6mS9yC1SnQppBxXw][logstash-2018.04.17][2]: SearchParseException[[logstash-2018.04.17][2]: from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"bool":{"filter":[{"range":{"@timestamp":{"gte":"1525757645955","lte":"1525779245955","format":"epoch_millis"}}},{"query_string":{"analyze_wildcard":true,"query":""}}]}},"aggs":{"2":{"date_histogram":{"interval":"30s","field":"@timestamp","min_doc_count":0,"extended_bounds":{"min":"1525757645955","max":"1525779245955"},"format":"epoch_millis"},"aggs":{}}}}]]]; nested: QueryParsingException[[logstash-2018.04.17] bool query does not support [filter]]; }{[ckJNQA6mS9yC1SnQppBxXw][logstash-2018.04.17][3]: SearchParseException[[logstash-2018.04.17][3]: from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"bool":{"filter":[{"range":{"@timestamp":{"gte":"1525757645955","lte":"1525779245955","format":"epoch_millis"}}},{"query_string":{"analyze_wildcard":true,"query":""}}]}},"aggs":{"2":{"date_histogram":{"interval":"30s","field":"@timestamp","min_doc_count":0,"extended_bounds":{"min":"1525757645955","max":"1525779245955"},"format":"epoch_millis"},"aggs":{}}}}]]]; nested: QueryParsingException[[logstash-2018.04.17] bool query does not support [filter]]; }{[ckJNQA6mS9yC1SnQppBxXw][logstash-2018.04.17][4]: SearchParseException[[logstash-2018.04.17][4]: from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"bool":{"filter":[{"range":{"@timestamp":{"gte":"1525757645955","lte":"1525779245955","format":"epoch_millis"}}},{"query_string":{"analyze_wildcard":true,"query":"*"}}]}},"aggs":{"2":{"date_histogram":{"interval":"30s","field":"@timestamp","min_doc_count":0,"extended_bounds":{"min":"1525757645955","max":"1525779245955

i am getting this error on grafana while viewing dashboard . can u please help me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants