How to ingest searchservice in Plugin

I want to create a REST Plugin in that I want to inject SearchService to play around with the tokens and frequencies so please suggest how to achieve the same

Can you please elaborate more on how exactly you want to "play around" with tokens and frequencies? Is your intention to produce scores for queries? Introspect stats on the index? Something else?

actually i want to make a word cloud from entire index so for that i have to access each word and its frequency and then do some processing on them and find most frequent word
this is the main purpose of our plugin

You may want to look at the significant text aggregation.

thank you for your reply
ya i can use that aggregation feature
but its a very costly operation on huge (1.5TB) indexed data
so we choose to make plugin and iterate over all the terms with our custom logic
so will you please suggest me some other solution using custom plugin for all term iterate

@rjernst
Please provide me update on this

@jprante
hello sir I am converting your plugin ( https://github.com/jprante/elasticsearch-index-termlist ) from version elasticsearch v1.5 to v2.4.3
I successfully register plugin in newer elasticsearch but there is one problem with

TransportTermlistAction
for v2.4.3

public class TransportTermlistAction
    extends TransportBroadcastAction<TermlistRequest, TermlistResponse, ShardTermlistRequest, ShardTermlistResponse> {

private final IndicesService indicesService;
private final Class<TermlistRequest> termlistRequestClass;
private final Class<ShardTermlistRequest> shardTermlistRequestClass;
private final String shardExecutor;
private final IndexNameExpressionResolver indexNameExpressionResolver;

@Inject
public TransportTermlistAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,TransportService transportService,IndicesService indicesService,ActionFilters actionFilters,
                                 IndexNameExpressionResolver indexNameExpressionResolver,Class<TermlistRequest> termlistRequestClass,Class<ShardTermlistRequest> shardTermlistRequestClass,String shardExecutor) {
    super(settings, TermlistAction.NAME, threadPool, clusterService, transportService, actionFilters,indexNameExpressionResolver,termlistRequestClass,shardTermlistRequestClass,shardExecutor);
    this.indicesService = indicesService;
    this.termlistRequestClass = termlistRequestClass;
    this.shardTermlistRequestClass = shardTermlistRequestClass;
    this.shardExecutor = "";
    this.indexNameExpressionResolver = indexNameExpressionResolver;
}

and for v1.5 as you wrote

public class TransportTermlistAction
    extends TransportBroadcastAction<TermlistRequest, TermlistResponse, ShardTermlistRequest, ShardTermlistResponse> {

private final static ESLogger logger = ESLoggerFactory.getLogger(TransportTermlistAction.class.getName());

private final IndicesService indicesService;

@Inject
public TransportTermlistAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
                               TransportService transportService,
                               IndicesService indicesService,
                               ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, TermlistAction.NAME, threadPool, clusterService, transportService, actionFilters,
            indexNameExpressionResolver, TermlistRequest.class, ShardTermlistRequest.class, ThreadPool.Names.GENERIC);
    this.indicesService = indicesService;
}

so here its giving error for 2.4.3

org.elasticsearch.common.inject.CreationException: Guice creation errors:

  1. Could not find a suitable constructor in java.lang.Class. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
    at java.lang.Class.class(Unknown Source)
    while locating java.lang.Class<org.xbib.elasticsearch.action.langdetect.LangdetectRequest>
    for parameter 7 at org.xbib.elasticsearch.action.langdetect.TransportLangdetectAction.(Unknown Source)
    at unknown

  2. Could not find a suitable constructor in java.lang.Class. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
    at java.lang.Class.class(Unknown Source)
    while locating java.lang.Class<org.xbib.elasticsearch.action.langdetect.ShardTermlistRequest>
    for parameter 8 at org.xbib.elasticsearch.action.langdetect.TransportLangdetectAction.(Unknown Source)
    at unknown

so can i complete this step will you please help me ?

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