For an own plugin I'd like to receive the list of all indices, i.e. the ouput of GET /_cat/indices?index=myindices-*&h=index
But I could not figure out how to set up the route in the es_route.js file.
At the moment it looks like: server.route({ path: '/api/elasticsearch_myplugin/_cat/indices', method: 'GET', handler(req, reply) { call(req, 'cat', { h: [], pri: '???' }).then(function (response) { reply(response); }); } });
From within the controller I make the call: $http.post('../api/elasticsearch_myplugin/_cat/indices', this.queryMatchAll()).then((response) => { console.log(response.data.hits.hits); });
I get this error message: POST http://localhost:5601/iaw/api/elasticsearch_myplugin/_cat/indices 404 (Not Found)
Does anybody have an idea how to configure the route properly?
From the code snippets it looks like you're creating the server side route handler for the GET method, but performing a POST request on the client side. That could explain the 404 response.
Yes, you right, this was a copy/paste failure.
I changed the call to $http.get('../api/elasticsearch_sicdayselector/_cat/indices', this.queryMatchAll()).then((response) => { console.log(response); });
but now I'm getting: GET http://localhost:5601/iaw/api/elasticsearch_myplugin/_cat/indices 500 (Internal Server Error)
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.