Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up7.8 RestHighLevelClient - Composable Index Templates API difficult to use #60750
Comments
|
Pinging @elastic/es-core-features (:Core/Features/Java High Level REST Client) |
|
Pinging @elastic/es-core-features (:Core/Features/Indices APIs) |
|
I totally think we could improve the APIs here, and potentially add a builder perhaps to make it easier to build the templates (instead of having to know everything up front) |
|
Hi @dakrone |
|
@mun-inder-jeet-singh go for it! Let me know if I can of any help |
|
Hi all, I have the same issue and I face too that rest high client doesn't have a method for put component template.
I hope this can be helpfull.
|
|
Thanks @dakrone.
Do we need to create something like this for ComposableIndexTemplate class ? |
|
@mun-inder-jeet-singh I would recommend adding a I wouldn't worry too much about adding one that takes a |
|
Was this already solved? Or can i contribute here? @dakrone @mun-inder-jeet-singh |
|
@antrix190 it has not already been solved |
|
@dakrone I would like to give it a try. |
|
Hi @antrix190 , I was working on this issue though, this was my first tryout for opensource, hence taking time to complete this issue. |
|
That's why i asked before picking it up. :) |
|
Can somebody please review my PR? |
I currently use the legacy IndexTemplates with the "inheritance" mechanism.
During runtime, my application, will read in plain JSON templates from the filesystem and make PutIndexTemplateRequests out of the content using the standard "source(Map<String, Object>)" API available in all Request subclasses to fill the request with the relevant content.
Now, that those templates are becoming legacy stuff, I started evaluating a migration to composite templates ( I think this is a very good concept!).
Now playing with the JAVA HighLevel API here is not very convenient, as there is no simple way to feed an existing JSON into the request. Basically everything must be provided manually in a constructor of ComposableIndexTemplate:
public ComposableIndexTemplate(List<String> indexPatterns, @Nullable Template template, @Nullable List<String> componentTemplates, @Nullable Long priority, @Nullable Long version, @Nullable Map<String, Object> metadata)which is kind of difficult to use.
It is not very clear how I create a ComponentTemplate or a IndexTemplate using such a component using that API..
I fully understood the "raw" way with HTTP and JSON, but the API does somehow makes it very difficult.
Maybe the API can be improved to match existing APIs.
Addendum:
Of course using the LowLevelClient works fine.