Multi Get API - POST equivalent?


(Ryan Jones) #1

Hi,

I want to use the Multi Get API, but can see that it uses the GET HTTP verb, yet takes in a body.

Is there a POST equivalent to this API?

I'm writing a Java-based application and using either a Jersey Client or UniRest to call the Elastic Search API.
Using these 2 libraries, I am unable to pass through a body to a GET.

Thanks,
Ryan


(Val Crettaz) #2

Yes, the multi get API also accepts POST instead of GET as can be seen in RestMultiGetAction.java:

public RestMultiGetAction(Settings settings, RestController controller) {
    super(settings);
    controller.registerHandler(GET, "/_mget", this);
    controller.registerHandler(POST, "/_mget", this);
    controller.registerHandler(GET, "/{index}/_mget", this);
    controller.registerHandler(POST, "/{index}/_mget", this);
    controller.registerHandler(GET, "/{index}/{type}/_mget", this);
    controller.registerHandler(POST, "/{index}/{type}/_mget", this);

    this.allowExplicitIndex = MULTI_ALLOW_EXPLICIT_INDEX.get(settings);
}

(system) #3

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