-
Notifications
You must be signed in to change notification settings - Fork 242
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 client and xcontent/json support #143
Comments
I would argue that the same need exists for queries. I have queries that are built based on json specified queries (easy to test, easy to comprehend) that previously could be composed using Some way to deserialize from JSON to Query (Or Query.Builder) would be most useful. |
wrapper query is available now since 7.17.0 |
@sothawo |
(don't think this is the right place for this, but trying to help) @sulaukad to build a query you could use:
or in a builder:
|
There is a way to deserialize JSON strings to a Request. But I don't know if it's something that will keep working. At this moment, it's possible to use the
@sothawo do you thinks this is a valid use? |
Don|t ask me, I am not maintaining this project, I am only using it, and yes, I use the |
Sorry for the late answer. The client's jsonp mapper provides an easy way to achieve that without having to deal with the intricacies of There are some "to" and "from" string methods in the tests: Lines 79 to 91 in 74164d8
And you can get the mapper from a client using Hope this answers the question. |
@swallez Is there any difference between obtaining a mapper from the transport versus just instantiating one? Is |
@adagios by The Java API client deserialization relies on its own So |
We've added support for loading JSON directly from object builders with a new This is backwards compatible and will be in the next 7.17 and 8.1 patch releases. The documentation for this new feature is already up for the main branch. |
@swallez a quick question about using deserialize (either with _DESERIALIZER or mapper.deserialize) for class CreateIndexRequest: I can get it working because an index name is mandatory when creating a CreateIndexRequest instance and there seem no way to provide it in the JSON data (it is simply ignored by the parser). I endup with the following exception:
Can you confirm that deserializing a CreateIndexRequest is indeed not supported (the deserialization only deserialize the request payload, not the other requests parameters) ? |
@sbrunot indeed, many requests have required properties that are part of the URL path, and this is typically the case for The new InputStream input = this.getClass()
.getResourceAsStream("some-index.json");
CreateIndexRequest req = CreateIndexRequest.of(b -> b
.index("some-index")
.withJson(input)
); This feature is already available in the 7.17.2 and 8.1.1 snapshots. |
Also, as I mentioned previously, |
Hello and I have a question:
I am trying out this new fluent client and have a bunch of projects that I wanted to migrate from the RHLC to the new API client. Now I am kinda stuck on an inconvenient spot, creating an index with settings and mapping. the builder and functional pattern are nice, though in our projects we put json-files for mappings and settings which are read and converted into an object/xContentBuilder so we do not have to implement complex settings/mappings into java code (and reuse without copy paste).
kinda like that
depending on the
shop
parameter different mappings are loaded.Is there a similar and fluent way doing that in the new client or are there any plans supporting json/xcontent?
The text was updated successfully, but these errors were encountered: