Count API _ Elasticsearch Reference.pdf - Learn/learn Docs/guide Docs/guide/contact EN Elasticsearch Reference[2.3(index.html � Search APIs(search.html

Count API _ Elasticsearch Reference.pdf - Learn/learn...

  • No School
  • AA 1
  • 6

This preview shows page 1 - 3 out of 6 pages.

Docs (/guide) Docs (/guide) Elasticsearch Reference [2.3] (index.html) » Search APIs (search.html) » Count API « Multi Search API (search-multi-search.html) Search Exists API » (search-exists.html) The count API allows to easily execute a query and get the number of matches for that query. It can be executed across one or more indices and across one or more types. The query can either be provided using a simple query string as a parameter, or using the Query DSL (query- dsl.html) de抡㥕ned within the request body. Here is an example: Both examples above do the same thing, which is count the number of tweets from the twitter index for a certain user. The result is: Count API $ curl ‐XGET '' $ curl ‐XGET '' ‐d ' { "query" : { "term" : { "user" : "kimchy" } } }' The query being sent in the body must be nested in a query key, same as the search api (search-search.html) works edit () Learn (/learn) (/) (/contact) EN
Image of page 1

Subscribe to view the full document.

The query is optional, and when not provided, it will use match_all to count all the docs. The count API can be applied to multiple types in multiple indices (search-search.html#search- multi-index-type). When executing count using the query parameter q , the query passed is a query string using Lucene query parser. There are additional parameters that can be passed: Name Description df The default 抡㥕eld to use when no 抡㥕eld pre抡㥕x is de抡㥕ned within the query.
Image of page 2
Image of page 3
  • Fall '19
  • Doug Cutting, Nutch

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes