# Cannot get the index information with GET method (404 not found)

**URL:** <https://discuss.elastic.co/t/cannot-get-the-index-information-with-get-method-404-not-found/141801>\
**Category:** Kibana\
**Created:** [July 26, 2018, 2:57pm UTC](https://discuss.elastic.co/t/cannot-get-the-index-information-with-get-method-404-not-found/141801 "2018-07-26T14:57:15Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![asallemi](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@asallemi](https://discuss.elastic.co/u/asallemi)\
**Post date:** [July 26, 2018, 2:57pm UTC](https://discuss.elastic.co/t/cannot-get-the-index-information-with-get-method-404-not-found/141801/1 "2018-07-26T14:57:15Z")

</div>

Hi,

I followed this [example](https://www.timroes.de/2016/02/21/writing-kibana-plugins-custom-applications/) to create my Kibana application. My use case is to display list of indices, select one and modify a specific line. As you see, this is the list of indices

 ![ss](https://us1.discourse-cdn.com/elastic/original/3X/f/1/f1e46d2c7957f8f4ec9556b59065abca4993c8dd.png)

Ths is my source code:  
**_routes.js:_**

```auto
export default function (server) {

  let call = server.plugins.elasticsearch.callWithRequest;

  server.route({
    path: '/api/indices_view/_list',
    method: 'GET',
    handler(req, reply) {
      call(req, 'cluster.state').then(function (response) {
        // Return just the names of all indices to the client.
        reply(Object.keys(response.data.indices));
      });
    }
  });
  
  server.route({
    path: '/api/indices_view/index/{name}',
    method: 'GET',
    handler(req, reply) {
      call(req, 'cluster.state', {
        metric: 'metadata',
        index: req.params.name
      }).then(function (response) {
        //console.log("Route RES ======>", response);
        reply(response.metadata.indices[req.params.name]);
      });
    }
  });
}

```

**_app.js:_**

```auto
import { uiModules } from 'ui/modules';
import uiRoutes from 'ui/routes';
import 'angular-ui-bootstrap';
import 'ui/autoload/styles';
import './less/style.less';
import index from './templates/index.html';
import list from './templates/list.html';

uiRoutes.enable();

uiRoutes
.when('/', {
  template: index,
  controller: 'indicesView',
  controllerAs: 'ctrl'
})
.when('/index/:name', {
  template: list,
  controller: 'getIndiceByName',
  controllerAs: 'ctrl'
});

uiModules
.get('app/indices_view')
.controller('indicesView', function ($http) {
  $http.get('../api/indices_view/_list').then((response) => {
    this.indices = Object.keys(response.data.indices);
  });
})
.controller('getIndiceByName', function($routeParams, $http) {
  this.index = $routeParams.name;
  $http.get(`../api/indices_view/index/${this.index}`).then((response) => {
    this.status = response.data;
    console.log("App RES ======>", response);
  });
});

```

**_index.html:_**

```auto
<div class="container-fluid">
    <div class="row col-md-12 panel panel-default">         
        <div class="panel-body">
            <div class="container">
                <div class="row">
                    <div class="col-sm-6 col-sm-offset-3">
                        <div id="imaginary_container"> 
                            <div class="input-group stylish-input-group">
                                <input type="text" class="form-control" placeholder="Search" ng-model="indice">
                                <span class="input-group-addon">
                                    <button type="submit">
                                        <span class="glyphicon glyphicon-search"></span>
                                    </button>  
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-8 col-sm-offset-2">
                        <ul class="list-group">
                            <li class="list-group-item" ng-repeat="index in ctrl.indices | filter : indice"">
                              <a href="#/index/{{index}}">{{ index }}</a>
                            </li>  
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

```

I got this in my log: `GET http://localhost:5601/api/indices_view/index/logstash-2015.05.20 404 (Not Found)`

 ![ssss](https://us1.discourse-cdn.com/elastic/original/3X/8/f/8ff67e2a5586eea0897af7737a83c10028fd51ee.png)

Did I miss something ? (This is the first time I use AngularJS)  
I'll appreciate any help and thanks for advance 🙂

Best regards !

---

<div class="post-metadata">

**Author:** ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)\
**Post date:** [July 26, 2018, 8:18pm UTC](https://discuss.elastic.co/t/cannot-get-the-index-information-with-get-method-404-not-found/141801/2 "2018-07-26T20:18:54Z")

</div>

Hmm, everything looks right, and since you're seeing the index list I'm assuming that the `/api/indices_view/_list` route is working fine. If you uncomment the `console.log("Route RES ======>", response);` line, does that should up in the console? If not then it's not even hitting that route, which is mysterious. Are you sure that the Kibana server has restarted and loaded your changes?

---

<div class="post-metadata">

**Author:** ![asallemi](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@asallemi](https://discuss.elastic.co/u/asallemi)\
**Post date:** [July 26, 2018, 8:43pm UTC](https://discuss.elastic.co/t/cannot-get-the-index-information-with-get-method-404-not-found/141801/3 "2018-07-26T20:43:56Z")

</div>

Thank you for your reply @spalger  
Yes I uncomment all **console.log** and restart the server but I still have the same problem ☹

---

<div class="post-metadata">

**Author:** ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)\
**Post date:** [July 26, 2018, 8:51pm UTC](https://discuss.elastic.co/t/cannot-get-the-index-information-with-get-method-404-not-found/141801/4 "2018-07-26T20:51:11Z")

</div>

If you put a console log at the top of that file do you see it when the server start up?

---

<div class="post-metadata">

**Author:** ![asallemi](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@asallemi](https://discuss.elastic.co/u/asallemi)\
**Post date:** [July 26, 2018, 9:31pm UTC](https://discuss.elastic.co/t/cannot-get-the-index-information-with-get-method-404-not-found/141801/5 "2018-07-26T21:31:04Z")

</div>

Sorry I was restarting my PC (obligation).  
I added the console log in the top of route.js and there is an error :

> error [21:23:58.959] [warning][process] UnhandledPromiseRejectionWarning: TypeError: call is not a function  
> at handler (C:/Users/A701291/Desktop/ElasticStack/kibana-6.3.0/plugins/handle\_app/ **server/routes.js:10** :7)

 ![eee](https://us1.discourse-cdn.com/elastic/original/3X/c/7/c7959b69d1afe69c5e3d43aec8d86cf8b511915f.png)

I remove the console log and restart the server, I still get this error. Any idea ? 🤐

---

<div class="post-metadata">

**Author:** ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)\
**Post date:** [July 26, 2018, 9:34pm UTC](https://discuss.elastic.co/t/cannot-get-the-index-information-with-get-method-404-not-found/141801/6 "2018-07-26T21:34:09Z")

</div>

Are you using the development version of Kibana for this? It sounds like it's caching things that it shouldn't be because you're using the distributable version.

Did you use the Kibana plugin generator to get started? [https://github.com/elastic/kibana/tree/master/packages/kbn-plugin-generator](https://github.com/elastic/kibana/tree/master/packages/kbn-plugin-generator)

---

<div class="post-metadata">

**Author:** ![asallemi](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@asallemi](https://discuss.elastic.co/u/asallemi)\
**Post date:** [July 26, 2018, 9:44pm UTC](https://discuss.elastic.co/t/cannot-get-the-index-information-with-get-method-404-not-found/141801/7 "2018-07-26T21:44:16Z")

</div>

No, I am not using the dev version. I downloaded Kibana and Elasticsearch version 6.3 from [here](https://www.elastic.co/fr/downloads). Few minutes everything work perfectly!

---

<div class="post-metadata">

**Author:** ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)\
**Post date:** [July 26, 2018, 9:46pm UTC](https://discuss.elastic.co/t/cannot-get-the-index-information-with-get-method-404-not-found/141801/8 "2018-07-26T21:46:26Z")

</div>

I suggest starting fresh with the plugin generator, and then moving the code you have right now into the output from the generator. Then you'll be able to use `yarn start` to run your plugin, the server will automatically restart when you make changes, and things will be much more development friendly.

We don't really support developing plugins within the distributable

---

<div class="post-metadata">

**Author:** ![asallemi](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@asallemi](https://discuss.elastic.co/u/asallemi)\
**Post date:** [July 26, 2018, 9:58pm UTC](https://discuss.elastic.co/t/cannot-get-the-index-information-with-get-method-404-not-found/141801/9 "2018-07-26T21:58:28Z")

</div>

Okay I'll do thanks @spalger 🙂

---

<div class="post-metadata">

**Author:** ![asallemi](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@asallemi](https://discuss.elastic.co/u/asallemi)\
**Post date:** [July 27, 2018, 1:22pm UTC](https://discuss.elastic.co/t/cannot-get-the-index-information-with-get-method-404-not-found/141801/10 "2018-07-27T13:22:24Z")

</div>

Hello again @spalger, I followed you by starting with the plugin generator and using development version of Kibana, but I faced a problem in setting up my Development Environment. May you check this [topic](https://discuss.elastic.co/t/problem-in-setting-up-my-development-environment-yarn-kbn-bootstrap-failed/141901) please. I'll appreciate that 🙂

Warm regards.

---

<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:** [August 24, 2018, 1:22pm UTC](https://discuss.elastic.co/t/cannot-get-the-index-information-with-get-method-404-not-found/141801/11 "2018-08-24T13:22:32Z")

</div>

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