No search type for [count]

Hi,

I am making a query with the following header:

"POST /test/_search?search_type=count"

as I saw in this question, but it results with the following exception:

{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "No search type for [count]"
}
],
"type": "illegal_argument_exception",
"reason": "No search type for [count]"
},
"status": 400
}

How can this be?

This option has been removed.

Just set size to 0

1 Like

Hi,
Which size do you mean?

If it is the size that I think it is then I get from the following query (you can see that size = 0)

POST /filebeat-*/log/_search?scroll=1m&pretty
{
    "size": 0,
   "query": {
    
   "bool":{ 

      "must": [
        
		{ "match": {"concatenated": "FALSE"}},
        { "range": 
          { 
            "delay": 
              {
                "gte": 0,
                "lt":  3
              } 
          }
        },
        { "range": 
          { 
            "eventTimestamp.raw": 
              {
                "gte" : "now-99999m/m",
                "lt" :  "now/m"
              } 
          }
        }
      ]
   }
  }
}

The result:

{
"_scroll_id": "DnF1ZXJ5VGhlbkZldGNoAgAAAAAAABTYFjFZR190RHl2VFotWTBfTHdNYUVLcVEAAAAAAAAU2RYxWUdfdER5dlRaLVkwX0x3TWFFS3FR",
"took": 6,
"timed_out": false,
"_shards": {
"total": 2,
"successful": 2,
"failed": 0
},
"hits": {
"total": 19,
"max_score": 0,
"hits":
}
}

Basicly it says the amount of logs that I want you to show me is 0, no?

Why using scroll here?

The response object gives you 19 hits which is basically a count.

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