Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count API - count the number of documents in an index pattern #6534

Merged
merged 3 commits into from
Mar 15, 2016

Conversation

Bargs
Copy link
Contributor

@Bargs Bargs commented Mar 14, 2016

Required by #6493

Description

This is a simple Kibana API that works similarly to Elasticsearch's _count api. The functionality is pared down and Kibana specific, only allowing you to retrieve the document count for a given index pattern.

Usage

The Count API supports both GET and POST requests for its single endpoint (POST was included so that the API can support a query body down the road, if required).

POST /api/kibana/{index_pattern}/_count
GET /api/kibana/{index_pattern}/_count

Response payload is a simple JSON document e.g.:

POST /api/kibana/logstash-*/_count

200 OK
{
  "count": 14005
}

Returns 404 if the pattern matches no existing indices.

@rashidkpc
Copy link
Contributor

Let's support both GET and POST here.

@rashidkpc rashidkpc assigned Bargs and unassigned rashidkpc Mar 14, 2016
@Bargs
Copy link
Contributor Author

Bargs commented Mar 15, 2016

@rashidkpc so the same endpoint, just accessible by either method? Or I should say, the same functionality.

@Bargs Bargs assigned rashidkpc and unassigned Bargs Mar 15, 2016
@Bargs
Copy link
Contributor Author

Bargs commented Mar 15, 2016

@rashidkpc added support for GET. Ready for another look.


server.route({
path,
method: 'POST',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this just be ['GET', 'POST']?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I even looked that up yesterday, I guess I didn't have enough coffee this morning. Updated.

@rashidkpc
Copy link
Contributor

LGTM

rashidkpc pushed a commit that referenced this pull request Mar 15, 2016
Count API - count the number of documents in an index pattern
@rashidkpc rashidkpc merged commit 866af9a into elastic:master Mar 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants