Parsing_exception

When i am trying to pull the data by using below query, i am getting the parsing_exception.

curl -XGET 'http://localhost:9200/debuglogs-*/_count?pretty' -d '{"query": { "bool": { "must": [ { "term": { "SessionId": "1492527551776" } }, { "term": { "Filename": "default.log" } } ] } }, "stored_fields" : ["times","level","errormessage"], "sort" : [{ "times" : {"order" : "asc"}}] }'

Ther Error is:

{
"error" : {
"root_cause" : [
{
"type" : "parsing_exception",
"reason" : "request does not support [stored_fields]",
"line" : 1,
"col" : 128
}
],
"type" : "parsing_exception",
"reason" : "request does not support [stored_fields]",
"line" : 1,
"col" : 128
},
"status" : 400
}

The Count API doesn't support "stored_fields." It also doesn't support "sort." The _count endpoint is meant to just provide you with counts, so these parameters wouldn't make senes.

I suspect you want one of two things:

  1. You meant to get the individual results back. If that's the case, use _search instead of _count
  2. You meant to only get the count. If that's the case, drop the stored_fields and sort parameters

Thanks, it is working.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.