RestAction paths/registrations overwriting each other

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

RestAction paths/registrations overwriting each other

Alexander Reelsen
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? :-)

Thanks for helping!


--Alexander
Reply | Threaded
Open this post in threaded view
|

Re: RestAction paths/registrations overwriting each other

kimchy
Administrator
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 <[hidden email]> 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? :-)

Thanks for helping!


--Alexander