# Error deserializing Phrase Suggester - Java API Client

**URL:** <https://discuss.elastic.co/t/error-deserializing-phrase-suggester-java-api-client/309058>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [July 7, 2022, 12:17am UTC](https://discuss.elastic.co/t/error-deserializing-phrase-suggester-java-api-client/309058 "2022-07-07T00:17:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [July 7, 2022, 12:17am UTC](https://discuss.elastic.co/t/error-deserializing-phrase-suggester-java-api-client/309058/1 "2022-07-07T00:17:01Z")

</div>

Hi everyone.

I'm implementing the Phrase Suggester in the Java API Client, the error below occurs:

```auto
[Request processing failed; nested exception is co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch.core.search.PhraseSuggest: co.elastic.clients.json.UnexpectedJsonEventException: Unexpected JSON event 'START_ARRAY' instead of '[START_OBJECT, KEY_NAME]' (JSON path: suggest['phrase#did_you_mean'][0].options) (line no=1, column no=243, offset=-1)] with root cause

co.elastic.clients.json.UnexpectedJsonEventException: Unexpected JSON event 'START_ARRAY' instead of '[START_OBJECT, KEY_NAME]'

```

Code:

```auto
 Map<String, FieldSuggester> map = new HashMap<>();
    map.put(Suggest.DID_YOU_MEAN, FieldSuggester.of(fs -> fs.phrase(p ->
            p.maxErrors(2.0).size(5).field("title.suggest")
        )
    ));
    Suggester suggester = Suggester.of(sg -> sg
        .suggesters(map)
        .text(term)
    );
    builder.suggest(suggester);

```

Is it an API bug or am I doing something wrong?

Extra info:  
ElasticSearch Java v8.3.1

---

<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:** [August 4, 2022, 12:17am UTC](https://discuss.elastic.co/t/error-deserializing-phrase-suggester-java-api-client/309058/2 "2022-08-04T00:17:44Z")

</div>

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