# Error while doing suggest query for java-client

**URL:** <https://discuss.elastic.co/t/error-while-doing-suggest-query-for-java-client/294828>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [January 19, 2022, 1:57pm UTC](https://discuss.elastic.co/t/error-while-doing-suggest-query-for-java-client/294828 "2022-01-19T13:57:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![2393747135](https://avatars.discourse-cdn.com/v4/letter/2/71e660/32.png) [@2393747135](https://discuss.elastic.co/u/2393747135)\
**Post date:** [January 19, 2022, 1:57pm UTC](https://discuss.elastic.co/t/error-while-doing-suggest-query-for-java-client/294828/1 "2022-01-19T13:57:15Z")

</div>

Regarding the java-client of suguest, the prompts need to be as follows when using:  
Missing required property 'TermSuggestOption.score  
Below is my code

```auto
SearchResponse<com.example.elasticsearch.generator.model.Test> search = client.search(request -> request.
                 index("test").
                 suggest(suggest -> suggest.
                         suggesters("title_suggest", value -> value.
                                 completion(v -> v.
                                 field("title")))), com.example.elasticsearch.generator.model.Test.class);

```

Error at compile time, how to solve this or my way is wrong

---

<div class="post-metadata">

**Author:** ![swallez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swallez/32/11972_2.png) [@swallez](https://discuss.elastic.co/u/swallez)\
**Post date:** [January 20, 2022, 10:21am UTC](https://discuss.elastic.co/t/error-while-doing-suggest-query-for-java-client/294828/2 "2022-01-20T10:21:25Z")

</div>

This code looks correct. What is the compilation error?

---

<div class="post-metadata">

**Author:** ![2393747135](https://avatars.discourse-cdn.com/v4/letter/2/71e660/32.png) [@2393747135](https://discuss.elastic.co/u/2393747135)\
**Post date:** [January 20, 2022, 11:02am UTC](https://discuss.elastic.co/t/error-while-doing-suggest-query-for-java-client/294828/3 "2022-01-20T11:02:05Z")

</div>

![image](https://us1.discourse-cdn.com/elastic/original/3X/5/f/5fdb41573a32382bc6f6187949b08cd0aebbce3a.png)

I don't know what's wrong with this

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/7/f78aded97f4adf6c92c4b86d5547aaa58a701bae.png)

---

<div class="post-metadata">

**Author:** ![swallez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swallez/32/11972_2.png) [@swallez](https://discuss.elastic.co/u/swallez)\
**Post date:** [January 20, 2022, 4:07pm UTC](https://discuss.elastic.co/t/error-while-doing-suggest-query-for-java-client/294828/4 "2022-01-20T16:07:03Z")

</div>

Ah right, it's a run time error, and not a compilation time error.

This issue has been identified: [client failed to parse completion suggest response · Issue #57 · elastic/elasticsearch-java · GitHub](https://github.com/elastic/elasticsearch-java/issues/57)

We're currently working on a fix that will be included in the next release.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 17, 2022, 4:07pm UTC](https://discuss.elastic.co/t/error-while-doing-suggest-query-for-java-client/294828/5 "2022-02-17T16:07:18Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
