Hi Jörg,
thanks for response!

I use default 'elasticsearch' cluster name and 'ordinary' match_all (as below)

Client client = new TransportClient().addTransportAddress(new
InetSocketTransportAddress("localhost", 9300));
SearchResponse response = client.prepareSearch().execute().actionGet();

 works fine (connects,executes and returns results). However, I can't
execute SimpleAction successfully over TransportClient (even with
cluster name set):


Client client = new
TransportClient(ImmutableSettings.settingsBuilder().put("cluster.name",
"elasticsearch")).addTransportAddress(new
InetSocketTransportAddress("localhost", 9300));

SimpleRequestBuilder builder = new SimpleRequestBuilder(client);
SearchResponse response = client.execute(SimpleAction.INSTANCE,
builder.request()).actionGet();

Both, elasticsearch server and client using TransportClient report
'simple action' plugin loaded (in console INFO), but on execute I get
NPE  on the client's side with trace:

org.elasticsearch.common.util.concurrent.UncategorizedExecutionException:
Failed execution
at 
org.elasticsearch.action.support.AdapterActionFuture.rethrowExecutionException(AdapterActionFuture.java:90)
at 
org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:50)
at 
org.xbib.elasticsearch.action.simple.SimpleActionTest.testSimpleAction(SimpleActionTest.java:26)
..

Caused by: java.lang.NullPointerException
at org.elasticsearch.action.search.SearchRequest.writeTo(SearchRequest.java:541)
at 
org.xbib.elasticsearch.action.simple.SimpleRequest.writeTo(SimpleRequest.java:38)

Am I missing or misunderstanding something?

Tomislav






2014-10-18 15:28 GMT+02:00 joergpra...@gmail.com <joergpra...@gmail.com>:
> You must set up a cluster name in the settings for the TransportClient,
> otherwise connection requests will be rejected by the cluster.
>
> Also, a dynmaic "new TransportClient()" for client instantiation is
> discouraged. By doing this, you open up a new threadpool each time.
> Recommend is to use a singleton instantiation for the whole JVM, and a
> single close() call on the TransportClient instance when JVM exits.
>
> Jörg
>
> On Sat, Oct 18, 2014 at 12:55 PM, Tomislav Poljak <tpol...@gmail.com> wrote:
>>
>> Hi,
>> if I understand correctly, seems it should be possible to use
>> SimpleRequest over TransportClient, is this correct?
>>
>> I couldn't get it to work using:
>>
>> Client client = new TransportClient().addTransportAddress(new
>> InetSocketTransportAddress("localhost", 9300));
>>
>> but when switched to node client, seems to work
>>
>> Node node = nodeBuilder().client(true).node();
>> Client client = node.client();
>>
>> I'm also interested in reducing results/aggs using some custom code,
>> but to have it executed on elasticsearch cluster not to transfer
>> results to client node and reduce it there, but I'm not sure if this
>> is possible with custom transport actions when using TransportClient.
>>
>> Any info on this would be appreciated,
>> Tomislav
>>
>>
>> 2014-09-11 20:44 GMT+02:00 joergpra...@gmail.com <joergpra...@gmail.com>:
>> > Yes. I have checked in some code for a simple action plugin.
>> >
>> > https://github.com/jprante/elasticsearch-simple-action-plugin
>> >
>> > The plugin implements a simple "match_all" search action, by reusing
>> > much of
>> > the code of the search action.
>> >
>> > Best,
>> >
>> > Jörg
>> >
>> >
>> >
>> > On Thu, Sep 11, 2014 at 7:55 PM, Sandeep Ramesh Khanzode
>> > <k.sandee...@gmail.com> wrote:
>> >>
>> >> Thanks for bearing with me till now :) Please provide one final input
>> >> on
>> >> this issue.
>> >>
>> >> Is there any example for a custom search action? If not, can you please
>> >> provide some details on how I can implement one?
>> >>
>> >> Thanks,
>> >> Sandeep
>> >>
>> >>
>> >> On Thu, Sep 11, 2014 at 4:53 PM, joergpra...@gmail.com
>> >> <joergpra...@gmail.com> wrote:
>> >>>
>> >>> You can not intercept the SearchResponse on the ES server itself.
>> >>> Instead, you must implement your custom search action.
>> >>>
>> >>> Jörg
>> >>>
>> >>> On Thu, Sep 11, 2014 at 10:00 AM, Sandeep Ramesh Khanzode
>> >>> <k.sandee...@gmail.com> wrote:
>> >>>>
>> >>>> When you say, 'receive the SearchResponse', is that in the ES Server
>> >>>> node or the TransportClient node that spawned the request? I would
>> >>>> want to
>> >>>> intercept the SearchResponse when created at the ES Server itself,
>> >>>> since I
>> >>>> want to send the subset of Response to another process on the same
>> >>>> node, and
>> >>>> it would not be very efficient to have the response sent back to the
>> >>>> client
>> >>>> node only to be sent back again.
>> >>>>
>> >>>> Thanks,
>> >>>> Sandeep
>> >>>>
>> >>>> On Thu, Sep 11, 2014 at 12:43 PM, joergpra...@gmail.com
>> >>>> <joergpra...@gmail.com> wrote:
>> >>>>>
>> >>>>> You can receive the SearchResponse, process the response, and return
>> >>>>> the response with whatever format you want.
>> >>>>>
>> >>>>> Jörg
>> >>>>>
>> >>>>> On Wed, Sep 10, 2014 at 11:59 AM, Sandeep Ramesh Khanzode
>> >>>>> <k.sandee...@gmail.com> wrote:
>> >>>>>>
>> >>>>>> Hi Jorg,
>> >>>>>>
>> >>>>>> Thanks for the links. I was checking the sources. There are
>> >>>>>> relevant
>> >>>>>> to my functional use case. But I will be using the TransportClient
>> >>>>>> Java API,
>> >>>>>> not the REST client.
>> >>>>>>
>> >>>>>> Can you please tell me how I can find/modify these classes/sources
>> >>>>>> to
>> >>>>>> get the appropriate classes for inctercepting the Search Response
>> >>>>>> when
>> >>>>>> invoked from a TransportClient?
>> >>>>>>
>> >>>>>>
>> >>>>>> Thanks,
>> >>>>>> Sandeep
>> >>>>>>
>> >>>>>> On Wed, Aug 27, 2014 at 6:38 PM, joergpra...@gmail.com
>> >>>>>> <joergpra...@gmail.com> wrote:
>> >>>>>>>
>> >>>>>>> Have a look at array-format or csv plugin, they are processing the
>> >>>>>>> SearchResponse to output it in another format:
>> >>>>>>>
>> >>>>>>> https://github.com/jprante/elasticsearch-arrayformat
>> >>>>>>>
>> >>>>>>> https://github.com/jprante/elasticsearch-csv
>> >>>>>>>
>> >>>>>>> Jörg
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> On Wed, Aug 27, 2014 at 3:05 PM, 'Sandeep Ramesh Khanzode' via
>> >>>>>>> elasticsearch <elasticsearch@googlegroups.com> wrote:
>> >>>>>>>>
>> >>>>>>>> Hi,
>> >>>>>>>>
>> >>>>>>>> Is there any action/module that I can extend/register/add so that
>> >>>>>>>> I
>> >>>>>>>> can intercept the SearchResponse on the server node before the
>> >>>>>>>> response is
>> >>>>>>>> sent back to the TransportClient on the calling box?
>> >>>>>>>>
>> >>>>>>>> Thanks,
>> >>>>>>>> Sandeep
>> >>>>>>>>
>> >>>>>>>> --
>> >>>>>>>> You received this message because you are subscribed to the
>> >>>>>>>> Google
>> >>>>>>>> Groups "elasticsearch" group.
>> >>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>> >>>>>>>> send an email to elasticsearch+unsubscr...@googlegroups.com.
>> >>>>>>>> To view this discussion on the web visit
>> >>>>>>>>
>> >>>>>>>> https://groups.google.com/d/msgid/elasticsearch/559a5c68-4567-425f-9842-7f2fe6755095%40googlegroups.com.
>> >>>>>>>> For more options, visit https://groups.google.com/d/optout.
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> --
>> >>>>>>> You received this message because you are subscribed to a topic in
>> >>>>>>> the Google Groups "elasticsearch" group.
>> >>>>>>> To unsubscribe from this topic, visit
>> >>>>>>>
>> >>>>>>> https://groups.google.com/d/topic/elasticsearch/o6RZL4KwJVs/unsubscribe.
>> >>>>>>> To unsubscribe from this group and all its topics, send an email
>> >>>>>>> to
>> >>>>>>> elasticsearch+unsubscr...@googlegroups.com.
>> >>>>>>> To view this discussion on the web visit
>> >>>>>>>
>> >>>>>>> https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGJ_%3D5RnyFqMP_AX4744z6tdAp8cfLBi_OqzLM23_rqzw%40mail.gmail.com.
>> >>>>>>>
>> >>>>>>> For more options, visit https://groups.google.com/d/optout.
>> >>>>>>
>> >>>>>>
>> >>>>>> --
>> >>>>>> You received this message because you are subscribed to the Google
>> >>>>>> Groups "elasticsearch" group.
>> >>>>>> To unsubscribe from this group and stop receiving emails from it,
>> >>>>>> send
>> >>>>>> an email to elasticsearch+unsubscr...@googlegroups.com.
>> >>>>>> To view this discussion on the web visit
>> >>>>>>
>> >>>>>> https://groups.google.com/d/msgid/elasticsearch/CAKnM90bENin_aU4AXa%3DTVHQ_SyTTn-89Rev5vjj3%3DoDikwstkQ%40mail.gmail.com.
>> >>>>>>
>> >>>>>> For more options, visit https://groups.google.com/d/optout.
>> >>>>>
>> >>>>>
>> >>>>> --
>> >>>>> You received this message because you are subscribed to a topic in
>> >>>>> the
>> >>>>> Google Groups "elasticsearch" group.
>> >>>>> To unsubscribe from this topic, visit
>> >>>>>
>> >>>>> https://groups.google.com/d/topic/elasticsearch/o6RZL4KwJVs/unsubscribe.
>> >>>>> To unsubscribe from this group and all its topics, send an email to
>> >>>>> elasticsearch+unsubscr...@googlegroups.com.
>> >>>>> To view this discussion on the web visit
>> >>>>>
>> >>>>> https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGWm8upDW9De7OvkM0cps%2BEyn3goo7Tgy3jyqJ8Jz5Khw%40mail.gmail.com.
>> >>>>>
>> >>>>> For more options, visit https://groups.google.com/d/optout.
>> >>>>
>> >>>>
>> >>>> --
>> >>>> You received this message because you are subscribed to the Google
>> >>>> Groups "elasticsearch" group.
>> >>>> To unsubscribe from this group and stop receiving emails from it,
>> >>>> send
>> >>>> an email to elasticsearch+unsubscr...@googlegroups.com.
>> >>>> To view this discussion on the web visit
>> >>>>
>> >>>> https://groups.google.com/d/msgid/elasticsearch/CAKnM90aQiQO-cFzVb3vi_h7Buf1NLyk_q3UOqLRMe0ZDsvQ_MA%40mail.gmail.com.
>> >>>>
>> >>>> For more options, visit https://groups.google.com/d/optout.
>> >>>
>> >>>
>> >>> --
>> >>> You received this message because you are subscribed to a topic in the
>> >>> Google Groups "elasticsearch" group.
>> >>> To unsubscribe from this topic, visit
>> >>>
>> >>> https://groups.google.com/d/topic/elasticsearch/o6RZL4KwJVs/unsubscribe.
>> >>> To unsubscribe from this group and all its topics, send an email to
>> >>> elasticsearch+unsubscr...@googlegroups.com.
>> >>> To view this discussion on the web visit
>> >>>
>> >>> https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEk0-VccZES3wNn8mEAbcuCJFV%3D8HKjw0udCAU-ysWXTA%40mail.gmail.com.
>> >>>
>> >>> For more options, visit https://groups.google.com/d/optout.
>> >>
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "elasticsearch" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> >> an
>> >> email to elasticsearch+unsubscr...@googlegroups.com.
>> >> To view this discussion on the web visit
>> >>
>> >> https://groups.google.com/d/msgid/elasticsearch/CAKnM90ZFshVUHHQM6fd0K9VCa14n0MDzUCxtu6zYV4kFciuBSQ%40mail.gmail.com.
>> >>
>> >> For more options, visit https://groups.google.com/d/optout.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "elasticsearch" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to elasticsearch+unsubscr...@googlegroups.com.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/elasticsearch/CAKdsXoENDoJG8Nkbd4%3Djn9kQH_O75pf5_ShaYy9rQy08NUYnvA%40mail.gmail.com.
>> >
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "elasticsearch" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to elasticsearch+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elasticsearch/CALuCJxhZ6t_7hx30QoD30f3B3erP499JSHCTGxAQvJ518fFv8A%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "elasticsearch" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elasticsearch+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEkFOeT4x7qi365MQ8Kz6f1YXWMc0-vV%2B0ur9PBYDAWSg%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CALuCJxgt25g1RHJuaVSZ37LLw-%3D%2BDAD0hY6gS8kCGh3zG_4KUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to