user5691041
user5691041

Reputation:

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. When i hit the API, it shows the request as pending when there is data in the elasticsearch.

Elasticsearch Query:

{
  "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. 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

Node.JS error:

Unhandled rejection [search_parse_exception] failed to parse search source. unknown search element [partial_fields]

Upvotes: 3

Views: 353

Answers (1)

manishrw
manishrw

Reputation: 429

It is quite evident from the error that elasticsearch is not able to identify/parse the term partial_fields. I looked up the ES site, and they have mentioned that ES doesn't support partial_fields term since version 2.x. Instead they recommend using source filtering. Please use the follow post for the changes in 2.x regarding source filtering.

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.

Upvotes: 1

Related Questions