Error: _analyze request throws NPE


(Ralph LeVan) #1

When I send "GET _analyze?analyzer=bob&text="test"" to ES (using Sense), I get no response. When I look in the logs, I see that TransportSingleShardAction$AsyncSingleAction has thrown a NullPointerException.

[2016-03-15 16:36:03,634][ERROR][transport ] [esap01] failed to handle exception for action [indices:admin/analyze[s]], handler [org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction$1@7304fe5c]
java.lang.NullPointerException
at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction.perform(TransportSingleShardAction.java:195)
at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction.access$700(TransportSingleShardAction.java:115)
at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction$1.handleException(TransportSingleShardAction.java:174)

Now, clearly the "bob" analyzer is bogus and the source of the error. When I replace "bob" with "standard", it works just fine. The real problem for me is that I'm trying to test a custom analyzer and I get the same result when I use it. The unhelpfulness of the response and the logging doesn't tell me if my code is bad or if the analyzer is unrecognized. (I'm pretty sure the analyzer is recognized because I can use it in a mapping.)

Any suggestions for how to work around this problem?

Using ES 2.1.0.

Thanks!


(Ralph LeVan) #2

I just installed analysis-phonetic and get the same lack of response when I try it:
GET _analyze?analyzer=analysis-phonetic&text="test"


(Jörg Prante) #3

There is a glitch in ES regarding _analyze endpoint without a given index name.

Please use

GET /test/_analyze?analyzer=bob&text=alice

Then, on an endpoint for index test for an undefined analyzer bob, you will see a message like

{
   "error": {
      "root_cause": [
         {
            "type": "remote_transport_exception",
            "reason": "[Nathaniel Essex][10.3.2.32:9300][indices:admin/analyze[s]]"
         }
      ],
      "type": "illegal_argument_exception",
      "reason": "failed to find analyzer [bob]"
   },
   "status": 400
}

(Ralph LeVan) #4

It's not quite that simple, because it does work with analyzer=standard and no index.

Thanks! That gets me another step further!

Ralph


(system) #5