AJAX request to Elasticsearch from Kibana 7.10

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:

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:


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?

1 Like

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.

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

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.

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