jprante / elasticsearch-jdbc

JDBC importer for Elasticsearch
Apache License 2.0
2.84k stars 709 forks source link

SearchPhaseExecutionException[Failed to execute phase [query], all shards failed #348

Closed linhaobuaa closed 10 years ago

linhaobuaa commented 10 years ago

Hi, I am using elasticsearch-river-jdbc

  1. When I execute this query, it succeed as below in mavel sense: GET jdbc/_search { "query": { "match_all": {} } { "took": 1, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 15902, "max_score": 1, "hits": [ { "_index": "jdbc", "_type": "jdbc", "_id": "7pt9GeDnSs6pB88IMas8yg", "_score": 1, "_source": { "fldRecdId": "2014092716322706", "fldItemId": 5, "fldPubRecdId": null, "fldAttCount": 0, "fldIconId": null, "fldSiteId": 6, "fldReadFlag": 0, "fldFlowFlag": 0, "fldBoldShow": 0, "fldRecdPwd": null, "fldRecdTextClr": null, "fldRecdBgndClr": null, "fldReadFromUrl": 0, "fldURLHash": "BCA55913A1275ABD6AD2A8D6A8CD0F72C2D17A55", "fldUrlAddr": "http://guba.eastmoney.com/news,600000,124626628.html", "fldCitedCount": 0, "fldrkdz": "http://guba.eastmoney.com/news,600000,124626628.html", "webname": "股吧", "gupiaomingchen": "浦发银行", "gupiaodaima": "600000", "fldtitle": "不到长城非好汗!!!!北京(宝鸡bj)欢迎您!!!!", "fldAuthor": "陕西西安股友", "fatierenaddress": null, "gudong": null, "Fldcontent": "不到长城非好汗!!!!北京(宝鸡bj)欢迎您!!!!", "fldrecddate": "2014-09-26 13:29:17", "fldzhhfdate": "09-26 13:29", "fldHits": "906", "fldReply": "0" } }, }
  2. however, when I execute sentence below, error comes in: GET jdbc/jdbc/_search { "query":{ "filtered": { "query": {}, "filter": { "term":{ "fldItemId": 5 } } } } } { "error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[SnXBimhNTzOVxys66xYSPg][jdbc][0]: SearchParseException[[jdbc][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\n \"query\":{\n \"filtered\": {\n \"query\": {},\n \"filter\": {\n \"term\":{\n \"fldItemId\": 5\n }\n }\n }\n }\n}\n]]]; nested: QueryParsingException[[jdbc] [_na] query malformed, no field after start_object]; }{[SnXBimhNTzOVxys66xYSPg][jdbc][1]: SearchParseException[[jdbc][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\n \"query\":{\n \"filtered\": {\n \"query\": {},\n \"filter\": {\n \"term\":{\n \"fldItemId\": 5\n }\n }\n }\n }\n}\n]]]; nested: QueryParsingException[[jdbc] [_na] query malformed, no field after start_object]; }{[SnXBimhNTzOVxys66xYSPg][jdbc][2]: SearchParseException[[jdbc][2]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\n \"query\":{\n \"filtered\": {\n \"query\": {},\n \"filter\": {\n \"term\":{\n \"fldItemId\": 5\n }\n }\n }\n }\n}\n]]]; nested: QueryParsingException[[jdbc] [_na] query malformed, no field after start_object]; }{[SnXBimhNTzOVxys66xYSPg][jdbc][3]: SearchParseException[[jdbc][3]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\n \"query\":{\n \"filtered\": {\n \"query\": {},\n \"filter\": {\n \"term\":{\n \"fldItemId\": 5\n }\n }\n }\n }\n}\n]]]; nested: QueryParsingException[[jdbc] [_na] query malformed, no field after start_object]; }{[SnXBimhNTzOVxys66xYSPg][jdbc][4]: SearchParseException[[jdbc][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\n \"query\":{\n \"filtered\": {\n \"query\": {},\n \"filter\": {\n \"term\":{\n \"fldItemId\": 5\n }\n }\n }\n }\n}\n]]]; nested: QueryParsingException[[jdbc] [_na] query malformed, no field after start_object]; }]", "status": 400 }

Is there anyone can help?

jprante commented 10 years ago

Your query is wrong. This is not an JDBC river issue.

Correct is

GET /jdbc/jdbc/_search
{
  "query":{
    "filtered": {
      "filter": {
        "term":{
          "fldItemId": 5
        }
      }
    }
  }
}
linhaobuaa commented 10 years ago

OK, thanks a lot