# How to ingest searchservice in Plugin

**URL:** <https://discuss.elastic.co/t/how-to-ingest-searchservice-in-plugin/141945>\
**Category:** Elasticsearch\
**Created:** [July 27, 2018, 12:42pm UTC](https://discuss.elastic.co/t/how-to-ingest-searchservice-in-plugin/141945 "2018-07-27T12:42:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hiral2cool](https://avatars.discourse-cdn.com/v4/letter/h/45deac/32.png) [@hiral2cool](https://discuss.elastic.co/u/hiral2cool)\
**Post date:** [July 27, 2018, 12:42pm UTC](https://discuss.elastic.co/t/how-to-ingest-searchservice-in-plugin/141945/1 "2018-07-27T12:42:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [July 30, 2018, 5:38pm UTC](https://discuss.elastic.co/t/how-to-ingest-searchservice-in-plugin/141945/2 "2018-07-30T17:38:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![hiral2cool](https://avatars.discourse-cdn.com/v4/letter/h/45deac/32.png) [@hiral2cool](https://discuss.elastic.co/u/hiral2cool)\
**Post date:** [July 31, 2018, 12:39pm UTC](https://discuss.elastic.co/t/how-to-ingest-searchservice-in-plugin/141945/3 "2018-07-31T12:39:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [July 31, 2018, 3:14pm UTC](https://discuss.elastic.co/t/how-to-ingest-searchservice-in-plugin/141945/4 "2018-07-31T15:14:50Z")

</div>

You may want to look at the [significant text aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/master/search-aggregations-bucket-significanttext-aggregation.html).

---

<div class="post-metadata">

**Author:** ![hiral2cool](https://avatars.discourse-cdn.com/v4/letter/h/45deac/32.png) [@hiral2cool](https://discuss.elastic.co/u/hiral2cool)\
**Post date:** [August 1, 2018, 4:29am UTC](https://discuss.elastic.co/t/how-to-ingest-searchservice-in-plugin/141945/5 "2018-08-01T04:29:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hiral2cool](https://avatars.discourse-cdn.com/v4/letter/h/45deac/32.png) [@hiral2cool](https://discuss.elastic.co/u/hiral2cool)\
**Post date:** [August 8, 2018, 10:25am UTC](https://discuss.elastic.co/t/how-to-ingest-searchservice-in-plugin/141945/6 "2018-08-08T10:25:31Z")

</div>

@rjernst  
Please provide me update on this

---

<div class="post-metadata">

**Author:** ![hiral2cool](https://avatars.discourse-cdn.com/v4/letter/h/45deac/32.png) [@hiral2cool](https://discuss.elastic.co/u/hiral2cool)\
**Post date:** [August 8, 2018, 11:59am UTC](https://discuss.elastic.co/t/how-to-ingest-searchservice-in-plugin/141945/7 "2018-08-08T11:59:57Z")

</div>

@jprante  
hello sir I am converting your plugin ( [https://github.com/jprante/elasticsearch-index-termlist](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 ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 5, 2018, 12:00pm UTC](https://discuss.elastic.co/t/how-to-ingest-searchservice-in-plugin/141945/8 "2018-09-05T12:00:03Z")

</div>

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