简体   繁体   English

Elasticsearch查询未给出结果,并显示待处理的请求

[英]Elasticsearch query not giving result, and shows pending request

I've created a node.js API, which fetches result from Elasticsearch based on the request parameters. 我创建了一个node.js API,它根据请求参数从Elasticsearch获取结果。 When i hit the API, it shows the request as pending when there is data in the elasticsearch. 当我点击API时,它会在elasticsearch中有数据时将请求显示为待处理。

Elasticsearch Query: Elasticsearch查询:

{
  "partial_fields": {
    "basic": {
      "include": [ "a", "b", "c", "d" ]
    }
  },
  "query": {
    "match": {
      "a" : "xyz"
    }
  }
}

When I check the status in Debug console, it shows status as PENDING . 当我在调试控制台中检查状态时,它显示状态为PENDING I don't know where i'm going wrong. 我不知道我哪里出错了。 Could somebody explain how should i approach to solve this problem ? 有人可以解释我应该如何解决这个问题?

EDIT : 编辑

Elasticsearch version is : 2.1.1 Elasticsearch版本是:2.1.1

Node.JS error: Node.JS错误:

Unhandled rejection [search_parse_exception] failed to parse search source. 未处理的拒绝[search_parse_exception]无法解析搜索源。 unknown search element [partial_fields] 未知搜索元素[partial_fields]

It is quite evident from the error that elasticsearch is not able to identify/parse the term partial_fields . 从错误中可以明显看出,elasticsearch无法识别/解析术语partial_fields I looked up the ES site, and they have mentioned that ES doesn't support partial_fields term since version 2.x. 我查了ES网站,他们已经提到ES自版本2.x以来不支持partial_fields术语。 Instead they recommend using source filtering. 相反,他们建议使用源过滤。 Please use the follow post for the changes in 2.x regarding source filtering. 请使用以下帖子了解2.x中有关源过滤的更改。

Please change your query to use source filter as follows: 请更改您的查询以使用源过滤器,如下所示:

{
  "_source: [ "a", "b", "c", "d" ],
  "query": {
    "match": {
      "a" : "xyz"
    }
  }
}

OR 要么

You could downgrade your ES version to < 2.x and then run the query. 您可以将ES版本降级为<2.x,然后运行查询。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM