Confused about search/count queries

I am taking ES training in NY later this month, but I sort of need to
know this before then.

I have index 'asset' of type 'ip'. Running ES 0.19.10

The query:

curl -XGET 'http://localhost:9200/asset/ip/_search' -d '{
"query" : {
"query_string" : {
"query" : "continent:EU"
}
}
}'

works fine but if instead of _search I use _count, it gives me an
exception.

"QueryParsingException[[asset] No query registered for [query]]"

If I change the request body, however, to:

 '{
      "query_string" : {
          "query" :"continent:EU"
      }
 }'

_count works.

What am I missing?

Thanks

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

}'

works fine but if instead of _search I use _count, it gives me an
exception.

"QueryParsingException[[asset] No query registered for [query]]"

If I change the request body, however, to:

 '{
      "query_string" : {
          "query" :"continent:EU"
      }
 }'

_count works.

What am I missing?

Only that the _search and _count APIs are different. The search API
takes various parameters, so you have to specify which is the query with
a parameter called "query".

The count API just takes a query, so the whole request body IS the
query.

clint

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.