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

Indices stats options #6390

Closed
wants to merge 10 commits into from
Closed

Indices stats options #6390

wants to merge 10 commits into from

Conversation

clintongormley
Copy link

This PR fixes two bugs in indices stats:

  • groups and types were being ignored
  • completion_fields with wildcards were not resolving the real field names

It also allows groups and types to accept wildcards, like fields, completion_fields and fielddata_fields

Added YAML tests for indices stats for: indices, metrics, level, fields, types, groups

The "groups" and "types" parameters to indices stats were being set too
early, so could end up being cleared.
The "fields" parameter to indices stats accepts wildcards, but
the "groups" and "types" parameters don't.
* metrics
* level
* fields
* groups
* types
@clintongormley
Copy link
Author

I've added YAML tests rather than Java test - are Java tests still required, even if they just duplicate the YAML tests?

- do:
indices.stats: {}

- match: { _shards.total: 20 }
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure we assume we have 20 shards in the index?

Copy link
Author

Choose a reason for hiding this comment

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

Yes we can. I'm checking the total number of defined shards, not active shards. The test creates two indices with default settings == 20 shards.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we randomize these in java land. If we don't do it now, the day is not far away..

Copy link
Member

Choose a reason for hiding this comment

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

We do randomize it....just run the tests and you'll see failures mvn clean test -Dtests.class=*.ElasticsearchRestTests or just run the ElasticsearchRestTests test form your IDE ;)

Copy link
Author

Choose a reason for hiding this comment

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

Good to know - I've pushed a change to make the tests more determinative in this case :)

@bleskes
Copy link
Contributor

bleskes commented Jun 4, 2014

Looking good! Left some comments

@clintongormley
Copy link
Author

@bleskes I've updated the PR in response to your comments.

@bleskes
Copy link
Contributor

bleskes commented Jun 4, 2014

@clintongormley changes look good. What about the number of shards tests?

@clintongormley
Copy link
Author

@bleskes pushed changes to make the number of shards predetermined.

@bleskes
Copy link
Contributor

bleskes commented Jun 5, 2014

LGTM!

@javanna
Copy link
Member

javanna commented Jun 5, 2014

My two cents on testing: the REST bug (groups and types were being ignored) can only be tested from a REST test. Beyond that, I'd love to see some Java test for these changes, although I do see that we have a very good coverage in terms of yaml tests. The reason is simply that we should not rely too much on the REST tests which are a bit of an afterthought and don't necessarily use all the randomizations that we use in our integration tests. Ideally we should be able to test the core without client tests as much as possible, and have a good coverage through Java tests.

@s1monw
Copy link
Contributor

s1monw commented Jun 5, 2014

+1 to what luca said! I think we should push towards java tests. Can we add those before pushing?

@clintongormley
Copy link
Author

Found a bug in the YAML tests where, thanks to randomization, primaries may not reflect, eg positive query count. Fixed that and added Java tests

client().prepareIndex("test1", "type2", Integer.toString(1)).setSource("field", "value").execute().actionGet();
client().prepareIndex("test2", "type", Integer.toString(1)).setSource("field", "value").execute().actionGet();

client().admin().indices().prepareRefresh().execute().actionGet();
Copy link
Member

Choose a reason for hiding this comment

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

you can use the common method refresh() here which checks also if there are failures in the response.

@clintongormley
Copy link
Author

@javanna thanks for looking at the tests. I've pushed a new commit which implements your changes.

@javanna
Copy link
Member

javanna commented Jun 10, 2014

Great work @clintongormley !!!!

clintongormley added a commit that referenced this pull request Jun 10, 2014
Bugs:
* "groups" and "types" were being ignored
* "completion_fields" as wildcards were not being resolved to fieldnames

Enhancements:
* Made "groups" and "types" support wildcards
* Added missing tests

Closes #6390
karmi added a commit to elastic/elasticsearch-ruby that referenced this pull request Jun 11, 2014
@s1monw s1monw removed the review label Jun 18, 2014
@clintongormley clintongormley changed the title Indices stats options Admin: Indices stats options Jul 16, 2014
@clintongormley clintongormley added :Data Management/Stats Statistics tracking and retrieval APIs and removed >enhancement labels Jun 7, 2015
@clintongormley clintongormley changed the title Admin: Indices stats options Indices stats options Jun 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/Stats Statistics tracking and retrieval APIs v1.3.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants