# App-Search alerts and warning sample search response

**URL:** <https://discuss.elastic.co/t/app-search-alerts-and-warning-sample-search-response/286724>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [October 14, 2021, 12:55pm UTC](https://discuss.elastic.co/t/app-search-alerts-and-warning-sample-search-response/286724 "2021-10-14T12:55:48Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Subhasis\_Dash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/subhasis_dash/32/68827_2.png) [@Subhasis\_Dash](https://discuss.elastic.co/u/Subhasis_Dash)\
**Post date:** [October 14, 2021, 12:55pm UTC](https://discuss.elastic.co/t/app-search-alerts-and-warning-sample-search-response/286724/1 "2021-10-14T12:55:48Z")

</div>

Hi

```auto
"meta": {
        "alerts": [],
        "warnings": [],
        "page": {
            "current": 1,
            "total_pages": 20,
            "total_results": 200,
            "size": 10
        },
        "engine": {
            "name": "search-engine",
            "type": "default"
        },
        "request_id": "03f59190596021a7de47c05fc8db291ec"
    }

```

Above is a sample search response, sometimes while searching we get **alerts** field which breaks our code, can you please give a sample response to how it looks like when we get alerts and warnings in response,

I wasn't able to find it in any documentation, so it would be of great help if some one from appsearch team shares a sample response.

Thank you,  
Subhasis Dash

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [October 14, 2021, 3:02pm UTC](https://discuss.elastic.co/t/app-search-alerts-and-warning-sample-search-response/286724/2 "2021-10-14T15:02:21Z")

</div>

According to our OpenAPI spec (not sure if that's published publicly anywhere or not) `warning` and `alerts` are both string arrays.

In what way is it breaking your code?

---

<div class="post-metadata">

**Author:** ![Subhasis\_Dash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/subhasis_dash/32/68827_2.png) [@Subhasis\_Dash](https://discuss.elastic.co/u/Subhasis_Dash)\
**Post date:** [October 28, 2021, 6:28am UTC](https://discuss.elastic.co/t/app-search-alerts-and-warning-sample-search-response/286724/3 "2021-10-28T06:28:02Z")

</div>

Hi @JasonStoltz I am getting JSON parse error

```auto
JSON parse error: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token

```

Can you please **share a example**. it would be of great help, as we are not able to replicate this issue

---

<div class="post-metadata">

**Author:** ![Subhasis\_Dash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/subhasis_dash/32/68827_2.png) [@Subhasis\_Dash](https://discuss.elastic.co/u/Subhasis_Dash)\
**Post date:** [November 9, 2021, 7:57am UTC](https://discuss.elastic.co/t/app-search-alerts-and-warning-sample-search-response/286724/4 "2021-11-09T07:57:33Z")

</div>

If anyone could share a sample response having "alerts" present it would be of great help ,Thank you.

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [November 9, 2021, 1:20pm UTC](https://discuss.elastic.co/t/app-search-alerts-and-warning-sample-search-response/286724/5 "2021-11-09T13:20:00Z")

</div>

Interesting. So it looks like you're receiving an object in a field instead of a string. Is it definitely the `alerts` field?

If so, does this happen intermittently or consistently? Production or development?

Are you able to just ignore the alerts field when parsing the response for now?

---

<div class="post-metadata">

**Author:** ![Subhasis\_Dash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/subhasis_dash/32/68827_2.png) [@Subhasis\_Dash](https://discuss.elastic.co/u/Subhasis_Dash)\
**Post date:** [November 9, 2021, 1:46pm UTC](https://discuss.elastic.co/t/app-search-alerts-and-warning-sample-search-response/286724/6 "2021-11-09T13:46:21Z")

</div>

This happens intermittently, perhaps when appsearch has heavy load,  
Sadly we are not able to replicate it.

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [November 9, 2021, 2:48pm UTC](https://discuss.elastic.co/t/app-search-alerts-and-warning-sample-search-response/286724/7 "2021-11-09T14:48:17Z")

</div>

Our `alerts` field is currently hardcoded to always be an empty array. Could it be another field causing this issue?

---

<div class="post-metadata">

**Author:** ![Subhasis\_Dash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/subhasis_dash/32/68827_2.png) [@Subhasis\_Dash](https://discuss.elastic.co/u/Subhasis_Dash)\
**Post date:** [November 11, 2021, 12:27pm UTC](https://discuss.elastic.co/t/app-search-alerts-and-warning-sample-search-response/286724/8 "2021-11-11T12:27:32Z")

</div>

We get this error :

```auto
Error while extracting response for type [class SearchResponse] and content type [application/json;charset=utf-8]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
at [Source: (PushbackInputStream); line: 1, column: 99] (through reference chain: model.SearchResponse["meta"]->model.Meta["alerts"]->java.util.ArrayList[0])

```

We get this error intermittently, could it be app-search sends another response when its experiencing heavy load.

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [November 11, 2021, 1:27pm UTC](https://discuss.elastic.co/t/app-search-alerts-and-warning-sample-search-response/286724/9 "2021-11-11T13:27:42Z")

</div>

@Subhasis_Dash Got it. That doesn't give me a lot to work off of. If you are able to log the API responses so we can see exactly what you're getting in the response, and is causing the error, that would be extremely helpful.

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [November 11, 2021, 1:55pm UTC](https://discuss.elastic.co/t/app-search-alerts-and-warning-sample-search-response/286724/10 "2021-11-11T13:55:00Z")

</div>

You may also be able to find this in the API logs for your engine.

---

<div class="post-metadata">

**Author:** ![Subhasis\_Dash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/subhasis_dash/32/68827_2.png) [@Subhasis\_Dash](https://discuss.elastic.co/u/Subhasis_Dash)\
**Post date:** [November 12, 2021, 5:34am UTC](https://discuss.elastic.co/t/app-search-alerts-and-warning-sample-search-response/286724/11 "2021-11-12T05:34:00Z")

</div>

Unfortunately with the high no of logs we are not able to do that.

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [November 15, 2021, 3:45pm UTC](https://discuss.elastic.co/t/app-search-alerts-and-warning-sample-search-response/286724/12 "2021-11-15T15:45:11Z")

</div>

The way I'm reading that error is that alerts is correctly an empty array ( `java.util.ArrayList[0]` ) but your code is trying to read it as a `String`.

Another possibility is that you're seeing a 500 / 503 and your code is looking to parse values that don't exist in that case.

Either way, you'll really need to be able to determine what the actual API response looks like to determine why your parsing logic is failing.

---

<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:** [December 13, 2021, 3:46pm UTC](https://discuss.elastic.co/t/app-search-alerts-and-warning-sample-search-response/286724/13 "2021-12-13T15:46:05Z")

</div>

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