Re: Custom cluster action

2015-03-26 Thread Paweł Róg
Hi Ali,

I used ClusterAction for my  case because I had to execute action on all 
nodes. I used something like this

public class CustomAction extends
ClusterActionCustomRequest, CustomResponse, CustomRequestBuilder{
... implement all required methods  (override newRequestBuilder and 
newResponse) ...


public class CustomNodeResponse extends NodeOperationResponse {
}


public class CustomRequest extends NodesOperationRequestCustomRequest {
... overide writeTo and readFrom methods ...
... add custom data fields in this class ... (for example I used id which 
was given in constructor and read/write in overridden methods ...

public class CustomRequestBuilder extends
NodesOperationRequestBuilderCustomRequest, 
CustomResponse, CustomRequestBuilder {
... override doExecute method. I used something below ...
@Override
protected void doExecute(ActionListenerCustomResponse listener) {
client.execute(CustomAction.INSTANCE, request, listener);
}


public class CustomResponse extends 
NodesOperationResponseNodeCustomResponse {
... implement writeTo and readFrom methods ...

public class NodeCustomResponse extends NodeOperationResponse {
... implement writeTo and readFrom methods ...


And finally the most important part

public class TransportCustomAction extends 
 TransportNodesOperationActionCustomRequest, CustomResponse,
TransportCustomAction.NodeCustomRequest, NodeCustomResponse {
... the main part is in nodeOperation method. here is implementation of 
your action ...


--
Paweł Róg

On Thursday, March 26, 2015 at 9:26:41 PM UTC+1, Ali Lotfdar wrote:

 Hi Pawel,

 I am new in creating action plugin, and I found you have already work on 
 it. Could you please let me know if there is any sample and explanation 
 which can help me to start.
 I already reviewed cookbook ES, but I could not understand its explanation!

 Thank you. 


 Regards,
 Ali

 On Thursday, November 13, 2014 at 1:06:00 AM UTC-5, Paweł Róg wrote:

 Hi,
 Thank you very much :-)

 Paweł

 On Wed, Nov 12, 2014 at 10:23 PM, Ivan Brusic iv...@brusic.com wrote:

 There is also an ActionModule

 public void onModule(ActionModule module) {
 module.registerAction(MyAction.INSTANCE, TransportMyAction.class);
 }

 It is always easier to follow existing plugins.

 Cheers,

 Ivan

 On Wed, Nov 12, 2014 at 3:50 PM, Pawel pro...@gmail.com wrote:

 Hi,
 I'm thinking about building custom ClusterAction. I see that I can 
 build custom classes for Request, NodeResponse and NodesRespone but it is 
 not clear to me how I can register my custom action.

 In case of Rest action it was quite easy because in plugin i simply use

 public void onModule(RestModule module) {
 module.addRestAction(RestCustomAction.class);
 }

 but I cannot find any examples how I can do this in case of custom 
 ClusterAction.

 Does anybody have any example how I can achieve this? Thanks for your 
 help.

 --
 Paweł Róg

 -- 
 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 elasticsearc...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com
  
 https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 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 elasticsearc...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com
  
 https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 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/58822bc2-dfe0-429a-be6c-e372e700396c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom cluster action

2015-03-26 Thread Ali Lotfdar
Hi Pawel,

I am new in creating action plugin, and I found you have already work on 
it. Could you please let me know if there is any sample and explanation 
which can help me to start.
I already reviewed cookbook ES, but I could not understand its explanation!

Thank you. 


Regards,
Ali

On Thursday, November 13, 2014 at 1:06:00 AM UTC-5, Paweł Róg wrote:

 Hi,
 Thank you very much :-)

 Paweł

 On Wed, Nov 12, 2014 at 10:23 PM, Ivan Brusic iv...@brusic.com 
 javascript: wrote:

 There is also an ActionModule

 public void onModule(ActionModule module) {
 module.registerAction(MyAction.INSTANCE, TransportMyAction.class);
 }

 It is always easier to follow existing plugins.

 Cheers,

 Ivan

 On Wed, Nov 12, 2014 at 3:50 PM, Pawel pro...@gmail.com javascript: 
 wrote:

 Hi,
 I'm thinking about building custom ClusterAction. I see that I can build 
 custom classes for Request, NodeResponse and NodesRespone but it is not 
 clear to me how I can register my custom action.

 In case of Rest action it was quite easy because in plugin i simply use

 public void onModule(RestModule module) {
 module.addRestAction(RestCustomAction.class);
 }

 but I cannot find any examples how I can do this in case of custom 
 ClusterAction.

 Does anybody have any example how I can achieve this? Thanks for your 
 help.

 --
 Paweł Róg

 -- 
 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 elasticsearc...@googlegroups.com javascript:.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com
  
 https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 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 elasticsearc...@googlegroups.com javascript:.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com
  
 https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 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/787c2ad8-ec02-44c2-a8e3-1fc7d3ad6a05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Sample custom cluster action

2015-03-24 Thread Ali Lotfdar
Hello All,

I would like create a cluster action (for instance for searching 
documents), but I could not find any sample to help me how implement
cluster action. I had looked on cookbook explanation and sample, although 
it was useful but I could not find how I can make it.

Thank you to let me have some sample or instruction document.

Regards,
Ali

-- 
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/d8fea8af-0b95-41cf-b6c2-27c1568b642b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Custom cluster action

2014-11-12 Thread Pawel
Hi,
I'm thinking about building custom ClusterAction. I see that I can build
custom classes for Request, NodeResponse and NodesRespone but it is not
clear to me how I can register my custom action.

In case of Rest action it was quite easy because in plugin i simply use

public void onModule(RestModule module) {
module.addRestAction(RestCustomAction.class);
}

but I cannot find any examples how I can do this in case of custom
ClusterAction.

Does anybody have any example how I can achieve this? Thanks for your help.

--
Paweł Róg

-- 
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/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom cluster action

2014-11-12 Thread Ivan Brusic
There is also an ActionModule

public void onModule(ActionModule module) {
module.registerAction(MyAction.INSTANCE, TransportMyAction.class);
}

It is always easier to follow existing plugins.

Cheers,

Ivan

On Wed, Nov 12, 2014 at 3:50 PM, Pawel pro...@gmail.com wrote:

 Hi,
 I'm thinking about building custom ClusterAction. I see that I can build
 custom classes for Request, NodeResponse and NodesRespone but it is not
 clear to me how I can register my custom action.

 In case of Rest action it was quite easy because in plugin i simply use

 public void onModule(RestModule module) {
 module.addRestAction(RestCustomAction.class);
 }

 but I cannot find any examples how I can do this in case of custom
 ClusterAction.

 Does anybody have any example how I can achieve this? Thanks for your help.

 --
 Paweł Róg

 --
 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/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com
 https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 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/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom cluster action

2014-11-12 Thread Pawel
Hi,
Thank you very much :-)

Paweł

On Wed, Nov 12, 2014 at 10:23 PM, Ivan Brusic i...@brusic.com wrote:

 There is also an ActionModule

 public void onModule(ActionModule module) {
 module.registerAction(MyAction.INSTANCE, TransportMyAction.class);
 }

 It is always easier to follow existing plugins.

 Cheers,

 Ivan

 On Wed, Nov 12, 2014 at 3:50 PM, Pawel pro...@gmail.com wrote:

 Hi,
 I'm thinking about building custom ClusterAction. I see that I can build
 custom classes for Request, NodeResponse and NodesRespone but it is not
 clear to me how I can register my custom action.

 In case of Rest action it was quite easy because in plugin i simply use

 public void onModule(RestModule module) {
 module.addRestAction(RestCustomAction.class);
 }

 but I cannot find any examples how I can do this in case of custom
 ClusterAction.

 Does anybody have any example how I can achieve this? Thanks for your
 help.

 --
 Paweł Róg

 --
 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/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com
 https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 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/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com
 https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 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/CAF9ZkbPQAoyQZ2drbscN%3DwV-rVXG7r%3DppvHWx%2BdkqrtF%2B_Cwvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.