# Custom plugin Java client query - Carrot2

**URL:** <https://discuss.elastic.co/t/custom-plugin-java-client-query-carrot2/7515>\
**Category:** Elasticsearch\
**Created:** [April 30, 2012, 1:26pm UTC](https://discuss.elastic.co/t/custom-plugin-java-client-query-carrot2/7515 "2012-04-30T13:26:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicom\_Nicom](https://avatars.discourse-cdn.com/v4/letter/n/b5e925/32.png) [@Nicom\_Nicom](https://discuss.elastic.co/u/Nicom_Nicom)\
**Post date:** [April 30, 2012, 1:26pm UTC](https://discuss.elastic.co/t/custom-plugin-java-client-query-carrot2/7515/1 "2012-04-30T13:26:26Z")

</div>

Hi,

I've successfully installed Carrot2 plugin  
([https://github.com/medcl/elasticsearch-carrot2](https://github.com/medcl/elasticsearch-carrot2)) and make some test via GUI  
(elasticsearch head plugin).

I'm trying to prepare and execute "query" using Java client but I'm having  
troubles.

CURL version works as expected:

curl -XPOST [http://localhost:9200/elasticsearch\_resources/\_carrot2?carrot2.fetch\_size=1800&carrot2.language=ENGLISH&carrot2.title\_fields=title&carrot2.summary\_fields=snippet&carrot2.url\_field=url&carrot2.attach\_detail=true](http://localhost:9200/elasticsearch_resources/_carrot2?carrot2.fetch_size=1800&carrot2.language=ENGLISH&carrot2.title_fields=title&carrot2.summary_fields=snippet&carrot2.url_field=url&carrot2.attach_detail=true)  
-d'  
{  
"query": {  
"bool": {  
"should": [  
{  
"match\_all": {}  
}  
]  
}  
},  
"from": 0,  
"size": 10  
}  
'

How can we prepare such a query from Java client (custom url with  
parameters)?  
How can I query custom plugin with Java API?

Thanks.

---

<div class="post-metadata">

**Author:** ![Mohit\_Chawla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohit_chawla/32/2243_2.png) [@Mohit\_Chawla](https://discuss.elastic.co/u/Mohit_Chawla)\
**Post date:** [April 30, 2012, 5:02pm UTC](https://discuss.elastic.co/t/custom-plugin-java-client-query-carrot2/7515/2 "2012-04-30T17:02:37Z")

</div>

I am not sure about the Java API, but I think this is sort of language  
agnostic. For eg., for the perl client, I had to modify the code to  
support requests for the carrot plugin ( which mainly involved  
defining the params for the request and the method ). I am not sure if  
there is a uniform/base api for (any) plugins to interface with.

On Mon, Apr 30, 2012 at 6:56 PM, Nicom Nicom [ahsalini@gmail.com](mailto:ahsalini@gmail.com) wrote:

> Hi,
> 
> I've successfully installed Carrot2 plugin  
> ([GitHub - medcl/elasticsearch-carrot2: a elasticsearch plugin integrated with carrot2,which clustering your search results into topics,](https://github.com/medcl/elasticsearch-carrot2)) and make some test via GUI  
> (elasticsearch head plugin).
> 
> I'm trying to prepare and execute "query" using Java client but I'm having  
> troubles.
> 
> CURL version works as expected:
> 
> curl -XPOST  
> [http://localhost:9200/elasticsearch\_resources/\_carrot2?carrot2.fetch\_size=1800&carrot2.language=ENGLISH&carrot2.title\_fields=title&carrot2.summary\_fields=snippet&carrot2.url\_field=url&carrot2.attach\_detail=true](http://localhost:9200/elasticsearch_resources/_carrot2?carrot2.fetch_size=1800&carrot2.language=ENGLISH&carrot2.title_fields=title&carrot2.summary_fields=snippet&carrot2.url_field=url&carrot2.attach_detail=true)  
> -d'  
> {  
> "query": {  
> "bool": {  
> "should": [  
> {  
> "match\_all": {}  
> }  
> ]  
> }  
> },  
> "from": 0,  
> "size": 10  
> }  
> '
> 
> How can we prepare such a query from Java client (custom url with  
> parameters)?  
> How can I query custom plugin with Java API?
> 
> Thanks.

---

<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:** [July 6, 2017, 3:30am UTC](https://discuss.elastic.co/t/custom-plugin-java-client-query-carrot2/7515/3 "2017-07-06T03:30:32Z")

</div>

Closed on July 6, 2017, 3:30am UTC


