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

Ensure PutMappingRequest.buildFromSimplifiedDef input are pairs #19837

Merged

Conversation

Projects
None yet
3 participants
@cbuescher
Copy link
Member

commented Aug 5, 2016

The method expects pairs of fieldnames and property arguments and will fail if the varargs input is an uneven number. We should check this and fail with an appropriate IllegalArgumentException instead.

Relates to #19836

@jasontedor

This comment has been minimized.

Copy link
Member

commented Aug 5, 2016

LGTM. Thanks @cbuescher!

Ensure PutMappingRequest.buildFromSimplifiedDef fails when input isn'…
…t pairs

The method requires pairs of fieldnames and property arguments and will fail if
the varargs input is an uneven number. We should check this and fail with an
appropriate IllegalArgumentException instead.

@cbuescher cbuescher force-pushed the cbuescher:inputValidation-PutMappingRequest branch to e57f76a Aug 5, 2016

@cbuescher cbuescher merged commit 37c433a into elastic:master Aug 5, 2016

2 checks passed

CLA Commit author is a member of Elasticsearch
Details
elasticsearch-ci Build finished.
Details
@sfalquier

This comment has been minimized.

Copy link

commented Jan 5, 2018

It looks like documentation for 6.1 is not up to date : https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-admin-indices.html
... since PutMappingRequestBuilder.setSource(String source) is no longer available.

How should we build a PutMappingRequest from json source as String now?

@cbuescher

This comment has been minimized.

Copy link
Member Author

commented Jan 5, 2018

@sfalquier thanks for the note, I think you are right about the docs needing an update, can you create a separate issue please and include a short description of you what you think is missing?

The setSource(String source) method has been deprecated in #22691 (version 5.3) in favour of #setSource(String, XContentType). So with a json source you would probably want to use setSource("{ ... }", XContentType.JSON). Hope this helps.

@sfalquier

This comment has been minimized.

Copy link

commented Jan 8, 2018

Thanks!
I have just opened an issue here : #28131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.