ElasticSearch嵌套:has_parent查询期间的NullPointerException

时间:2013-10-23 03:21:04

标签: elasticsearch

我遇到了奇怪的问题

http://  machinename:9200/1_exposureindex/riskitemsearch/_search/

    {
  "query": {
    "has_parent": {
      "parent_type": "contractsearch",
      "query": {
        "term": {
          "Name": "4l4"
        }
      }
    }
  }
}

当我执行此查询时,我得到空指针异常

{
error: SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures {[zohpYnUKQNSpROOg6eER9Q][1_exposureindex][1]: SearchParseException[[1_exposureindex][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"has_parent":{"parent_type":"contractsearch","query":{"term":{"Name":"4l4"}}}}}]]]; nested: NullPointerException; }{[zohpYnUKQNSpROOg6eER9Q][1_exposureindex][0]: SearchParseException[[1_exposureindex][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"has_parent":{"parent_type":"contractsearch","query":{"term":{"Name":"4l4"}}}}}]]]; nested: NullPointerException; }]
status: 500
}

但是当我执行has_child

时,同样的查询有效
e.g. 
http://   machinename:9200/1_exposureindex/contractsearch/_search/

    {
  "query": {
    "has_child": {
      "type": "riskitemsearch",
      "query": {
        "term": {
          "Name": "4l4"
        }
      }
    }
  }
}

1 个答案:

答案 0 :(得分:0)

我想出了问题,这是映射问题。我将_parent设置为InitCase,其中实际父级为小写。

此致 VB