Skip to content

Conversation

@javanna
Copy link
Member

@javanna javanna commented Nov 20, 2016

The type parameter has always been accepted by the search_shards api, probably to make the api and its urls the same as search. Truth is that the type never had any effect, it's been ignored from day one while accepting it may make users think that we actually do something with it.

This commit removes support for the type parameter from the REST layer and the Java API. Backwards compatibility is maintained on the transport layer though.

The new added serialization test also uncovered a bug in the java API where the ClusterSearchShardsRequest could be created with no arguments, but the indices were required to be not null otherwise the request couldn't be serialized as writeTo would throw NPE. Fixed by setting a default value (empty array) for indices.

Note that we could backport this to 5.x and make it non breaking on the REST layer, by maintaining the endpoint that accepts the type but log a deprecation warning for it. Then the version checks on the transport layer would need to be updated in this PR too.

@javanna javanna added :Search/Search Search-related issues that do not fall into other categories >breaking >enhancement review v6.0.0-alpha1 labels Nov 20, 2016
Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

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

LGTM. Let's add deprecation logging to 5.x as a follow-up?

Copy link
Contributor

Choose a reason for hiding this comment

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

Does it matter that requireNonNull throws a NPE rather than an IAE like before?

Copy link
Member Author

Choose a reason for hiding this comment

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

good point. I don't think so, we were not testing this behaviour anywhere. Added a test for this now.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe leave a quick comment, eg. // types so that the reader can know what this parameter was about

Copy link
Member Author

Choose a reason for hiding this comment

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

definitely makes sense

@javanna javanna force-pushed the enhancement/remove_types_search_shards branch from 9f0ee10 to 879ff34 Compare November 21, 2016 21:28
The `type` parameter has always been accepted by the search_shards api, probably to make the api and its urls the same as search. Truth is that the type never had any effect, it's been ignored from day one while accepting it may make users think that we actually do something with it.

This commit removes support for the type parameter from the REST layer and the Java API. Backwards compatibility is maintained on the transport layer though.

The new added serialization test also uncovered a bug in the java API where the `ClusterSearchShardsRequest` could be created with no arguments, but the indices were required to be not null otherwise the request couldn't be serialized as `writeTo` would throw NPE. Fixed by setting a default value (empty array) for indices.
@javanna javanna force-pushed the enhancement/remove_types_search_shards branch from 879ff34 to 4e6cbe0 Compare November 21, 2016 21:39
@javanna
Copy link
Member Author

javanna commented Nov 22, 2016

retest this please

javanna added a commit to javanna/elasticsearch that referenced this pull request Nov 22, 2016
The `type` parameter has always been accepted by the search_shards api, probably to make the api and its urls the same as search. Truth is that the type never had any effect, it's been ignored from day one while accepting it may make users think that we actually do something with it.

This commit deprecate support for the type parameter from the REST layer and removes it from the Java API. Backwards compatibility is maintained on the transport layer though.

The new added serialization test also uncovered a bug in the java API where the `ClusterSearchShardsRequest` could be created with no arguments, but the indices were required to be not null otherwise the request couldn't be serialized as `writeTo` would throw NPE. Fixed by setting a default value (empty array) for indices.

Relates to elastic#21688
@javanna
Copy link
Member Author

javanna commented Nov 22, 2016

retest this please

javanna added a commit that referenced this pull request Nov 22, 2016
The `type` parameter has always been accepted by the search_shards api, probably to make the api and its urls the same as search. Truth is that the type never had any effect, it's been ignored from day one while accepting it may make users think that we actually do something with it.

This commit deprecate support for the type parameter from the REST layer and removes it from the Java API. Backwards compatibility is maintained on the transport layer though.

The new added serialization test also uncovered a bug in the java API where the `ClusterSearchShardsRequest` could be created with no arguments, but the indices were required to be not null otherwise the request couldn't be serialized as `writeTo` would throw NPE. Fixed by setting a default value (empty array) for indices.

Relates to #21688
@javanna javanna merged commit db8b2dc into elastic:master Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>breaking :Search/Search Search-related issues that do not fall into other categories v6.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants