RestAction paths/registrations overwriting each other


(Alexander Reelsen) #1

Hi,

I have a problem registering a controller handler directly under the
root URL. I try to call this in my RestAction

controller.registerHandler(POST, "/_suggestRefresh", this);

However the RestIndexAction seems to overwrite my controller
registration, where as the RestIndicesAliasesAction works as expected.
Is this something which is due to the loading order of the
controllers?

This results that I always get an error like this (coming from the
RestIndexAction):

{"error":"InvalidIndexNameException[[_suggestRefresh] Invalid index
name [suggestRefresh], must not start with '']","status":400}

Any tips how I can change this behaviour? Am I doing some stupid
mistake? :slight_smile:

Thanks for helping!

--Alexander


(Shay Banon) #2

Actual constants will be preferred compared to wildcards when registering
an action, so if you provide /_suggestRefresh your action will be executed.
Are you sure you are registering the action / using the correct http verb?
This is done in many places in elasticsearch (like /_optimize, or
/_refresh).

On Tue, Dec 20, 2011 at 5:21 PM, Alexander Reelsen <
alexander.reelsen@googlemail.com> wrote:

Hi,

I have a problem registering a controller handler directly under the
root URL. I try to call this in my RestAction

controller.registerHandler(POST, "/_suggestRefresh", this);

However the RestIndexAction seems to overwrite my controller
registration, where as the RestIndicesAliasesAction works as expected.
Is this something which is due to the loading order of the
controllers?

This results that I always get an error like this (coming from the
RestIndexAction):

{"error":"InvalidIndexNameException[[_suggestRefresh] Invalid index
name [suggestRefresh], must not start with '']","status":400}

Any tips how I can change this behaviour? Am I doing some stupid
mistake? :slight_smile:

Thanks for helping!

--Alexander


(system) #3