Wich RestHandler for Index Settings?


(ESUser10) #1

If I create a index like:
PUT /test
{
"type": "test",
"fs": {
"url": "c:\temp",
"update_rate": "1h"

}
}

I will get this settings of the Index with a RestHandler in a Plugin.
MyQuestion is wich Resthandler can I use to get the IndexSettings?


With RestHandler to get Index Settings
#2

What information do you want to get exactly?
For basic informations about the count of documents or the status of the index you can use the following command:

curl 'localhost:9200/_cat/indices?v'

Cheers,
Alex


(ESUser10) #3

I write a plugin. If a Index created, i will get the index settings.
The BaseRestHandler (public class ManageIndicesRestActions extends BaseRestHandler) get only the Index Name.
But I will get the Settings of the Index:
PUT /test
{
"type": "test",
"fs": {
"url": "c:\temp",
"update_rate": "1h"

}
}


#4

Hmm.. I'm not quite sure if I got your question..
You create an index with a command like the following:

curl -XPUT 'localhost:9200/test?pretty' -d '
{
"mappings": {....}
}'

Once you've done that, you can add items e.g.

PUT  /test
{
  "type": "test",
  "fs": {
    "url": "c:\temp",
    "update_rate": "1h"

  }
}

If you want to get deeper informations about the index, you can use the stats API:

https://www.elastic.co/guide/en/elasticsearch/reference/1.x/indices-stats.html

Does that help you?


(ESUser10) #5

No that was not my question.
Also I write a plugin with a RestController:

public class ManageIndicesRestActions extends BaseRestHandler {{

    @Inject
    public ManageIndicesRestActions(Settings settings, final Client client,
        final RestController controller) {
    super(settings, controller, client);

    /* close index */
    controller.registerHandler(Method.POST, "/{index}/_close", this);
    controller.registerHandler(Method.PUT, "/{index}/_close", this);

    /* open index */
    controller.registerHandler(Method.POST, "/{index}/_open", this);
    controller.registerHandler(Method.PUT, "/{index}/_open", this);

    /* create index */
    controller.registerHandler(Method.POST, "/{index}", this);
    controller.registerHandler(Method.PUT, "/{index}", this);

    }

If a create a Index with

   PUT  /test
{
  "type": "test",
  "fs": {
    "url": "c:\temp",
    "update_rate": "1h"

  }
}

then this Controller handleRequest Method is called. In this Method I receive only the Index name and not the others settings like "url, uodate_rate,,,,,,"


(system) #6