使用 ElasticSearch Java 客户端获取 SearchPhaseExecutionException
Getting SearchPhaseExecutionException using ElasticSearch Java Client
我正在使用带排序的筛选查询。当我 运行 使用浏览器插件进行查询时,它 运行 没问题。但是当我使用 ElasticSearch 附带的 java 客户端时,出现错误
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed
to execute phase [dfs], all shards failed; 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": {}
}
] }
我知道这个错误听起来像是我正在排序的字段在某些索引中丢失了。但是我在我的排序中提供了 "missing" 选项,当我从 ES 浏览器头插件中 运行 时,查询 运行 就很好。
您是否发现 Java 客户端的查询结构有任何问题或其他问题?
我收到异常是因为我对某个字段使用了排序,而该字段在一定数量的索引文档中不存在。我重新索引了所有文件并且它起作用了。
我正在使用带排序的筛选查询。当我 运行 使用浏览器插件进行查询时,它 运行 没问题。但是当我使用 ElasticSearch 附带的 java 客户端时,出现错误
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to execute phase [dfs], all shards failed; 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": {}
}
] }
我知道这个错误听起来像是我正在排序的字段在某些索引中丢失了。但是我在我的排序中提供了 "missing" 选项,当我从 ES 浏览器头插件中 运行 时,查询 运行 就很好。
您是否发现 Java 客户端的查询结构有任何问题或其他问题?
我收到异常是因为我对某个字段使用了排序,而该字段在一定数量的索引文档中不存在。我重新索引了所有文件并且它起作用了。