# Search API requests returns Error 500 Internal Server Error: An internal server error occurred

**URL:** <https://discuss.elastic.co/t/search-api-requests-returns-error-500-internal-server-error-an-internal-server-error-occurred/352260>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [February 1, 2024, 8:41am UTC](https://discuss.elastic.co/t/search-api-requests-returns-error-500-internal-server-error-an-internal-server-error-occurred/352260 "2024-02-01T08:41:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![PustyB](https://avatars.discourse-cdn.com/v4/letter/p/c67d28/32.png) [@PustyB](https://discuss.elastic.co/u/PustyB)\
**Post date:** [February 1, 2024, 8:41am UTC](https://discuss.elastic.co/t/search-api-requests-returns-error-500-internal-server-error-an-internal-server-error-occurred/352260/1 "2024-02-01T08:41:19Z")

</div>

Hi I have a problem with Enterprise search. I have loaded the index and want to test the search through Search UI. And generally it works fine, but sometimes the error "Internal server error. Please check your application server logs for more details and contact Elastic support if the problem persists." pops up.  
I noticed in Api Logs that this happens when the query is empty

Of course, I do not make empty inquiries. It's just that after some time of inactivity on the site it throws me this error.

```auto
"{
  "query": "",
  "result_fields": {
    "block.date": {
      "raw": {},
      "snippet": {
        "size": 100,
        "fallback": true
      }
    },
"

```

What could be the problem? With other indexes this problem does not exist, but this index has more than 100 million documents, others only 5.

---

<div class="post-metadata">

**Author:** ![joemcelroy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joemcelroy/32/103757_2.png) [@joemcelroy](https://discuss.elastic.co/u/joemcelroy)\
**Post date:** [February 1, 2024, 9:27am UTC](https://discuss.elastic.co/t/search-api-requests-returns-error-500-internal-server-error-an-internal-server-error-occurred/352260/2 "2024-02-01T09:27:42Z")

</div>

hiya

Which connector are you using? The elasticsearch-connector or app-search-connector? I presume the app-search-connector in this example as you are using enterprise search.

Its fine to be performing empty queries, it should return back all the results.

is the response a 5xx from the API?

It could be down to a particular result thats causing issues with serialising. One way to diagnose is to copy the request and repeat it in postman but adjusting the size and from parameters to bring back a single result to see if you get a 200 or 500 back. Also adjusting the result fields too.

Joe

---

<div class="post-metadata">

**Author:** ![PustyB](https://avatars.discourse-cdn.com/v4/letter/p/c67d28/32.png) [@PustyB](https://discuss.elastic.co/u/PustyB)\
**Post date:** [February 1, 2024, 9:36am UTC](https://discuss.elastic.co/t/search-api-requests-returns-error-500-internal-server-error-an-internal-server-error-occurred/352260/3 "2024-02-01T09:36:32Z")

</div>

Yes im using app-search-connector.

The response from api is 500

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

---

<div class="post-metadata">

**Author:** ![joemcelroy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joemcelroy/32/103757_2.png) [@joemcelroy](https://discuss.elastic.co/u/joemcelroy)\
**Post date:** [February 1, 2024, 9:46am UTC](https://discuss.elastic.co/t/search-api-requests-returns-error-500-internal-server-error-an-internal-server-error-occurred/352260/4 "2024-02-01T09:46:09Z")

</div>

Do you get the same error in kibana when you browse to documents, do you see the same error? (fails to render)

---

<div class="post-metadata">

**Author:** ![PustyB](https://avatars.discourse-cdn.com/v4/letter/p/c67d28/32.png) [@PustyB](https://discuss.elastic.co/u/PustyB)\
**Post date:** [February 1, 2024, 9:52am UTC](https://discuss.elastic.co/t/search-api-requests-returns-error-500-internal-server-error-an-internal-server-error-occurred/352260/5 "2024-02-01T09:52:05Z")

</div>

> [@joemcelroy](#):
>
> Do you get the same error in kibana when you browse to documents, do you see the same error? (fails to render)

No, when I use the discover option in kibana to preview the index I get no errors.

---

<div class="post-metadata">

**Author:** ![joemcelroy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joemcelroy/32/103757_2.png) [@joemcelroy](https://discuss.elastic.co/u/joemcelroy)\
**Post date:** [February 1, 2024, 9:54am UTC](https://discuss.elastic.co/t/search-api-requests-returns-error-500-internal-server-error-an-internal-server-error-occurred/352260/6 "2024-02-01T09:54:47Z")

</div>

this section located on url `/app/enterprise_search/app_search/engines/<engine_name>/documents`?

Theres another area in kibana called discover which is querying elasticsearch indices directly which i dont expect to break.

---

<div class="post-metadata">

**Author:** ![PustyB](https://avatars.discourse-cdn.com/v4/letter/p/c67d28/32.png) [@PustyB](https://discuss.elastic.co/u/PustyB)\
**Post date:** [February 1, 2024, 9:55am UTC](https://discuss.elastic.co/t/search-api-requests-returns-error-500-internal-server-error-an-internal-server-error-occurred/352260/7 "2024-02-01T09:55:16Z")

</div>

In postman when i

```auto
{
  "query": "",
  "result_fields": {
    "block.date": {
      "raw": {},
      "snippet": {
        "size": 21,
        "fallback": true
      }
    },

```

In postman, when it executes POST with empty query and size is set to 100 it gets error. On the other hand, when I change the size to 21 I get a response.

When the query is not empty ( i mean query": "blabla") then with size 100 it works.

---

<div class="post-metadata">

**Author:** ![joemcelroy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joemcelroy/32/103757_2.png) [@joemcelroy](https://discuss.elastic.co/u/joemcelroy)\
**Post date:** [February 1, 2024, 9:57am UTC](https://discuss.elastic.co/t/search-api-requests-returns-error-500-internal-server-error-an-internal-server-error-occurred/352260/8 "2024-02-01T09:57:36Z")

</div>

Ok thanks!

actually what is contained in date? Snippet provides highlighting on matches in date. Do you need highlighting here?

---

<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 29, 2024, 9:57am UTC](https://discuss.elastic.co/t/search-api-requests-returns-error-500-internal-server-error-an-internal-server-error-occurred/352260/9 "2024-02-29T09:57:36Z")

</div>

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