NPE on DeleteByQuery


#1

I'm trying to migrate to elasticsearch 5.0.0 and I'm stuck with DeleteByQuery which is used in our project.

According to the documentation [1], the java plugin is no longer needed as it moved to the core in elasticsearch 5.0.0.

When creating a DeleteByQueryAction I cause a NPE in: TransportProxyClient, line 63. As line 62 sets the variable proxy to null as it can't find the action "DeleteByQueryAction" in the proxies Map

    public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> void execute(final Action<Request, Response, RequestBuilder> action, final Request request, ActionListener<Response> listener) {
        final TransportActionNodeProxy<Request, Response> proxy = proxies.get(action);
        nodesService.execute((n, l) -> proxy.execute(n, request, l), listener);
    }

Now after searching the codebase a bit, I found that the DeleteByQueryAction was part of the ReindexPlugin and indeed, adding this to the plugins solved the problem. Is this intended and was just forgotten in the documentation?

Now I'm not sure if I'm the only one who had the problem but I think it would be good to mention in the documentation that you need to add the ReindexPlugin to the list of plugins. Now the elastic documentation is a bit convoluted and I would like to add some notes on this but I'm not sure where such a note would be appropriate.

[1] https://www.elastic.co/guide/en/elasticsearch/plugins/current/plugins-delete-by-query.html


(Yannick Welsch) #2

Reindex (and thus DeleteByQuery) is a module that's bundled with the server (i.e. a built-in plugin). If you use the PreBuiltTransportClient (see here), it should be automatically loaded as plugin. How are you creating the transport client?


#3

Interesting! I was getting the transport client from ESIntegTestCase.

...
    // Gets rid of No handler for action [Action [indices:data/write/delete/byquery]
    @Override
    protected Collection<Class<? extends Plugin>> nodePlugins() {
        //noinspection unchecked
        return (Collection) Arrays.asList(ReindexPlugin.class);
    }

    // Gets rid of NPE DeleteByQuery
    @Override
    protected Collection<Class<? extends Plugin>> transportClientPlugins() {
        //noinspection unchecked
        return (Collection) Arrays.asList(ReindexPlugin.class);
    }
...
        InternalTestCluster server = (InternalTestCluster) cluster();
        TransportClient blaclient = (TransportClient) server.transportClient();
...

The two overrides adding the plugin on the node and client get rid of the exceptions.


(Yannick Welsch) #4

yes, we do the same in our test infrastructure for the reindex / deletebyquery plugin :slight_smile:


#5

OK, so the plugins are only needed when using ESIntegTestCase.

Thanks for the fast reply.


(system) #6

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