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

searchTemplate is confusing with field/value #593

Open
JohnDavidLarsen opened this issue Jun 12, 2023 · 0 comments
Open

searchTemplate is confusing with field/value #593

JohnDavidLarsen opened this issue Jun 12, 2023 · 0 comments
Labels
Area: Documentation Improvements or additions to documentation

Comments

@JohnDavidLarsen
Copy link

JohnDavidLarsen commented Jun 12, 2023

Java API client version

8.8

Java version

11

Elasticsearch Version

8.8

Problem description

Your example for searchTemplate in documentation and code was confusing as multiple people who were assisting me all assumed Field and Value should be the fields and values that we were replacing.

       SearchTemplateResponse<Product> response = esClient.searchTemplate(r -> r
                .index("some-index")
                .id("query-script") // <1>
                .params("field", JsonData.of("some-field")) // <2>
                .params("value", JsonData.of("some-data")),
            Product.class
        );

So if we had 3 parameters, a,b,c we kept attempting

                .params("field", JsonData.of("a")) 
                .params("value", JsonData.of("some-data-for-a"))
                .params("field", JsonData.of("b")) 
                .params("value", JsonData.of("some-data-for-b"))
                .params("field", JsonData.of("c"))
                .params("value", JsonData.of("some-data-for-c"))

As often field:value arrays are done in such way.
Is there a way you can make the example more clear?

@l-trotta l-trotta added the Area: Documentation Improvements or additions to documentation label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants