# String json to SearchResponse

**URL:** <https://discuss.elastic.co/t/string-json-to-searchresponse/298543>\
**Category:** Elasticsearch\
**Created:** [March 1, 2022, 6:03pm UTC](https://discuss.elastic.co/t/string-json-to-searchresponse/298543 "2022-03-01T18:03:22Z")\
**Posts on this page:** 3\
**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:** [March 1, 2022, 6:03pm UTC](https://discuss.elastic.co/t/string-json-to-searchresponse/298543/1 "2022-03-01T18:03:22Z")

</div>

Hello.

I used the example below to turn the json response into a SearchResponse and it worked fine.  
I made a change in my json file by adding the "suggest" but now I can't parse it correctly.  
Does anyone have any tips?

Try

```auto
 Map<String, ContextParser<Object, ? extends Suggest>> mapSuggest = new HashMap<>();
    entries.addAll(mapSuggest.entrySet().stream()
        .map(entry -> new NamedXContentRegistry.Entry(Suggest.class, new ParseField(entry.getKey()), entry.getValue()))
        .collect(Collectors.toList()));

```

but it does not work...

> <https://stackoverflow.com/questions/44239366/string-json-to-elasticsearch-searchresponse-object>

---

<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:** [March 1, 2022, 6:38pm UTC](https://discuss.elastic.co/t/string-json-to-searchresponse/298543/2 "2022-03-01T18:38:53Z")

</div>

I decided.  
you must enter the suggester type, in my case "completion#category\_name"

---

<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:** [March 29, 2022, 6:39pm UTC](https://discuss.elastic.co/t/string-json-to-searchresponse/298543/3 "2022-03-29T18:39:04Z")

</div>

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