使用ElasticSearch Java Client获取SearchPhaseExecutionException

时间:2015-07-23 00:14:17

标签: elasticsearch elasticsearch-plugin

我正在使用带有排序的过滤查询。当我使用浏览器插件运行查询时,它运行正常。但是当我使用ElasticSearch附带的java客户端时,我会收到错误

  

org.elasticsearch.action.search.SearchPhaseExecutionException:失败   执行阶段[dfs],所有分片都失败了; shardFailures

以下是正在运行的查询

{
    "from": 0,
    "size": 50,
    "query": {
        "filtered": {
            "query": {
                "bool": {
                    "must": {
                        "bool": {
                            "should": [
                                {
                                    "match": {
                                        "_all": {
                                            "query": "Happy Pharrel Williams",
                                            "type": "boolean"
                                        }
                                    }
                                },
                                {
                                    "flt": {
                                        "fields": [
                                            "name",
                                            "artists",
                                            "genre",
                                            "albumName"
                                        ],
                                        "like_text": "Happy Pharrel Williams"
                                    }
                                }
                            ]
                        }
                    }
                }
            },
            "filter": {
                "bool": {
                    "must": {
                        "or": {
                            "filters": [
                                {
                                    "range": {
                                        "releaseInfo.us": {
                                            "from": null,
                                            "to": "2015-07-22T23:16:12.852Z",
                                            "include_lower": true,
                                            "include_upper": true
                                        }
                                    }
                                },
                                {
                                    "and": {
                                        "filters": [
                                            {
                                                "missing": {
                                                    "field": "releaseInfo.us"
                                                }
                                            },
                                            {
                                                "range": {
                                                    "releaseInfo.WW": {
                                                        "from": null,
                                                        "to": "2015-07-22T23:16:12.851Z",
                                                        "include_lower": true,
                                                        "include_upper": true
                                                    }
                                                }
                                            }
                                        ]
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        }
    },
    "fields": [],
    "sort": [
        {
            "popularity.US": {
                "order": "asc",
                "missing": 999
            }
        },
        {
            "_score": {}
        }
    ] }

我理解错误听起来像我正在排序的字段在某些索引中缺失。但我在我的排序中提供了“缺失”选项,当我从ES浏览器头插件运行时,查询运行正常。

您是否看到查询结构或Java Client的其他内容有什么问题?

1 个答案:

答案 0 :(得分:0)

我得到了异常,因为我在一定数量的索引文档中不存在的字段上使用了排序。我重新编制了所有文件的索引,并且有效。