# AJAX request to Elasticsearch from Kibana 7.10

**URL:** <https://discuss.elastic.co/t/ajax-request-to-elasticsearch-from-kibana-7-10/260229>\
**Category:** Kibana\
**Created:** [January 5, 2021, 3:45pm UTC](https://discuss.elastic.co/t/ajax-request-to-elasticsearch-from-kibana-7-10/260229 "2021-01-05T15:45:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssimmons](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@ssimmons](https://discuss.elastic.co/u/ssimmons)\
**Post date:** [January 5, 2021, 3:45pm UTC](https://discuss.elastic.co/t/ajax-request-to-elasticsearch-from-kibana-7-10/260229/1 "2021-01-05T15:45:54Z")

</div>

In previous version of Kiabana I was able to do ajax post requests to the elasticsearch instance by using the following URL structure: `http://localhost:5601/cdp/elasticsearch/_msearch` and pass in my query object data. This does not seem to work in Kiabana 7.10 as it gives me a 404 error. In the dev tools I can post my query request and it returns the data so I know my query format is correct. Anyone know what has changed in 7.10 to cause this to stop working or know what I need to change to get this to work in Kibana 7.10? Here's my ajax request:

```auto
return $.ajax({
      url: URL.msearch(),
      data: dbQuery.toESQueryString(),
      headers: { 'content-type': 'application/x-ndjson' },
      method: 'POST'
   });

```

Here's my query object. It gets a call to `JSON.stringify()` in the `dbQuery.toESQueryString()` function:

```auto
{"index":"es_data","ignore_unavailable":true}
{"timeout":"30000ms","size":0,"aggs":{"cats":{"terms":{"field":"cntry_name","size":5000}}}}

```

---

<div class="post-metadata">

**Author:** ![poff](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/poff/32/81795_2.png) [@poff](https://discuss.elastic.co/u/poff)\
**Post date:** [January 5, 2021, 8:32pm UTC](https://discuss.elastic.co/t/ajax-request-to-elasticsearch-from-kibana-7-10/260229/2 "2021-01-05T20:32:43Z")

</div>

Hey there!

The `/elasticsearch/_msearch` route was removed from Kibana in 7.10 as we moved to a new plugin system. Is there any particular reason why you're not able to send your request to the elasticsearch instance? Was your use case for proxying a request through Kibana to the ES instance?

---

<div class="post-metadata">

**Author:** ![ssimmons](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@ssimmons](https://discuss.elastic.co/u/ssimmons)\
**Post date:** [January 5, 2021, 8:52pm UTC](https://discuss.elastic.co/t/ajax-request-to-elasticsearch-from-kibana-7-10/260229/3 "2021-01-05T20:52:46Z")

</div>

We've written a lot of custom plugins for Kibana for our customer. I'm trying to see if we can port them to 7.10. Some of our plugins access data from different Elasticsearch indexes when the user click on a button. We send them to the Elasticsearch instance using the `_msearch` command in Kibana. That way we don't have mess with Elasticsearch authentication since it's handled through Kibana. Is there another way to do multiple request to Elasticsearch within Kibana 7.10? I can see from viewing network activity that 7.10 now uses the `http://localhost:5601/cdp/internal/search/ese` command to search Elastic. Is there any documentation I can view about the `ese` search command and how to use it or code samples? That might work for what we are doing.

---

<div class="post-metadata">

**Author:** ![poff](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/poff/32/81795_2.png) [@poff](https://discuss.elastic.co/u/poff)\
**Post date:** [January 5, 2021, 10:56pm UTC](https://discuss.elastic.co/t/ajax-request-to-elasticsearch-from-kibana-7-10/260229/4 "2021-01-05T22:56:39Z")

</div>

Got it. So, while there are `/internal/` routes, they are deprecated and will be removed in the near future.

What I'd recommend doing is migrating to have the `data` plugin as a dependency within your plugin so that you can make use of the `search` api to retrieve your results. There's some documentation on using the search api here: [https://github.com/elastic/kibana/blob/master/src/plugins/data/README.mdx#search](https://github.com/elastic/kibana/blob/master/src/plugins/data/README.mdx#search)

---

<div class="post-metadata">

**Author:** ![ssimmons](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@ssimmons](https://discuss.elastic.co/u/ssimmons)\
**Post date:** [January 6, 2021, 4:20pm UTC](https://discuss.elastic.co/t/ajax-request-to-elasticsearch-from-kibana-7-10/260229/5 "2021-01-06T16:20:48Z")

</div>

Thanks for your response. I was able to get this working in 7.10 using the `/internal/_msearch` route. I know this will not be supported in future versions of Kibana, but I'm OK with that. This is a proof of concept that I can get our plugins working in 7.10.

---

<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 3, 2021, 4:20pm UTC](https://discuss.elastic.co/t/ajax-request-to-elasticsearch-from-kibana-7-10/260229/6 "2021-02-03T16:20:56Z")

</div>

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