# Elasticsearch-carrot2 JAVA API call

**URL:** <https://discuss.elastic.co/t/elasticsearch-carrot2-java-api-call/16166>\
**Category:** Elasticsearch\
**Created:** [March 5, 2014, 9:53am UTC](https://discuss.elastic.co/t/elasticsearch-carrot2-java-api-call/16166 "2014-03-05T09:53:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Petr\_Jansky](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@Petr\_Jansky](https://discuss.elastic.co/u/Petr_Jansky)\
**Post date:** [March 5, 2014, 9:53am UTC](https://discuss.elastic.co/t/elasticsearch-carrot2-java-api-call/16166/1 "2014-03-05T09:53:07Z")

</div>

Hello,

I use elasticsearch-carrot2[https://github.com/carrot2/elasticsearch-carrot2](https://github.com/carrot2/elasticsearch-carrot2)and I was not able to find how to get cluster result using JAVA API e.g. for

GET \_search\_with\_clusters?pretty=true  
{  
"query" : {  
"bool": {  
"must": [  
{ "term": { "content": "zeman"}}  
]  
}  
},  
"query\_hint": "vodafone",  
"field\_mapping": {  
"url": ["\_source.reference"],  
"title": ["\_source.title"],  
"content": ["\_source.content"]  
}  
}

result

{  
"took": 12,  
"timed\_out": false,  
"\_shards": {  
"total": 49,  
"successful": 49,  
"failed": 0  
},  
"hits": {  
"total": 2080562,  
"max\_score": 1,  
"hits": [.....]  
},  
"clusters": [  
{  
"id": 0,  
"score": 4.094963866819582,  
"label": "Možné Scénáře",  
"phrases": [  
"Možné Scénáře"  
],  
"documents": [

"[http://www.denik.cz/z\_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114206](http://www.denik.cz/z_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114206)",

"[http://www.denik.cz/z\_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114186](http://www.denik.cz/z_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114186)",

"[http://www.denik.cz/z\_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114174](http://www.denik.cz/z_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114174)"  
]  
},  
....  
],  
"info": {  
"algorithm": "lingo",  
"search-millis": "11",  
"clustering-millis": "26",  
"total-millis": "38",  
"include-hits": "true"  
}  
}

is there any way how call this query using JAVA API?

Thx  
Petr

--  
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+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/7a23e5a5-15ed-40be-80d9-fa93eebc28fe%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7a23e5a5-15ed-40be-80d9-fa93eebc28fe%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Dawid\_Weiss](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dawid_weiss/32/1643_2.png) [@Dawid\_Weiss](https://discuss.elastic.co/u/Dawid_Weiss)\
**Post date:** [March 5, 2014, 12:03pm UTC](https://discuss.elastic.co/t/elasticsearch-carrot2-java-api-call/16166/2 "2014-03-05T12:03:01Z")

</div>

In short: yes. Perhaps the best way to check out how to use Java API  
is to look at unit tests. For example:

[https://github.com/carrot2/elasticsearch-carrot2/blob/master/src/test/java/org/carrot2/elasticsearch/ClusteringActionTests.java#L65](https://github.com/carrot2/elasticsearch-carrot2/blob/master/src/test/java/org/carrot2/elasticsearch/ClusteringActionTests.java#L65)

I would also use a language code field and mapping for Czech; this  
should improve your clustering results (especially if you tweak the  
default lexical resources in Carrot2... patches welcome :).

[https://github.com/carrot2/elasticsearch-carrot2/blob/master/src/test/java/org/carrot2/elasticsearch/ClusteringActionTests.java#L100](https://github.com/carrot2/elasticsearch-carrot2/blob/master/src/test/java/org/carrot2/elasticsearch/ClusteringActionTests.java#L100)

Dawid

On Wed, Mar 5, 2014 at 10:53 AM, Petr Janský [petr.jansky@6hats.cz](mailto:petr.jansky@6hats.cz) wrote:

> Hello,
> 
> I use elasticsearch-carrot2 and I was not able to find how to get cluster  
> result using JAVA API e.g. for
> 
> GET \_search\_with\_clusters?pretty=true  
> {  
> "query" : {  
> "bool": {  
> "must": [  
> { "term": { "content": "zeman"}}  
> ]  
> }  
> },  
> "query\_hint": "vodafone",  
> "field\_mapping": {  
> "url": ["\_source.reference"],  
> "title": ["\_source.title"],  
> "content": ["\_source.content"]  
> }  
> }
> 
> result
> 
> {  
> "took": 12,  
> "timed\_out": false,  
> "\_shards": {  
> "total": 49,  
> "successful": 49,  
> "failed": 0  
> },  
> "hits": {  
> "total": 2080562,  
> "max\_score": 1,  
> "hits": [.....]  
> },  
> "clusters": [  
> {  
> "id": 0,  
> "score": 4.094963866819582,  
> "label": "Možné Scénáře",  
> "phrases": [  
> "Možné Scénáře"  
> ],  
> "documents": [
> 
> "[http://www.denik.cz/z\_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114206](http://www.denik.cz/z_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114206)",
> 
> "[http://www.denik.cz/z\_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114186](http://www.denik.cz/z_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114186)",
> 
> "[http://www.denik.cz/z\_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114174](http://www.denik.cz/z_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114174)"  
> ]  
> },  
> ....  
> ],  
> "info": {  
> "algorithm": "lingo",  
> "search-millis": "11",  
> "clustering-millis": "26",  
> "total-millis": "38",  
> "include-hits": "true"  
> }  
> }
> 
> is there any way how call this query using JAVA API?
> 
> Thx  
> Petr
> 
> --  
> 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+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/7a23e5a5-15ed-40be-80d9-fa93eebc28fe%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7a23e5a5-15ed-40be-80d9-fa93eebc28fe%40googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAM21Rt-PXv1DjckL\_t5yvUrip\_pLr%3DyL2R2LPWSYidtdbjBOig%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAM21Rt-PXv1DjckL_t5yvUrip_pLr%3DyL2R2LPWSYidtdbjBOig%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Petr\_Jansky](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@Petr\_Jansky](https://discuss.elastic.co/u/Petr_Jansky)\
**Post date:** [March 5, 2014, 12:32pm UTC](https://discuss.elastic.co/t/elasticsearch-carrot2-java-api-call/16166/3 "2014-03-05T12:32:31Z")

</div>

Hi Dawid,

thank you for your reply. I tried the sample you sent me  
[https://github.com/carrot2/elasticsearch-carrot2/blob/master/src/test/java/org/carrot2/elasticsearch/ClusteringActionTests.java#L65](https://github.com/carrot2/elasticsearch-carrot2/blob/master/src/test/java/org/carrot2/elasticsearch/ClusteringActionTests.java#L65)

but I got  
Exception in thread "main"  
org.elasticsearch.common.util.concurrent.UncategorizedExecutionException:  
Failed execution  
at  
org.elasticsearch.action.support.AdapterActionFuture.rethrowExecutionException(AdapterActionFuture.java:88)  
at  
org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:49)  
at  
es.search.ClusteringActionTests.testAttributes(ClusteringActionTests.java:85)  
at es.search.ClusteringActionTests.main(ClusteringActionTests.java:61)  
Caused by: java.lang.ClassCastException: java.lang.Boolean cannot be cast  
to java.util.Map  
at  
org.elasticsearch.common.io.stream.StreamInput.readMap(StreamInput.java:319)  
at  
org.carrot2.elasticsearch.ClusteringAction$ClusteringActionRequest.readFrom(ClusteringAction.java:407)  
at  
org.elasticsearch.transport.netty.MessageChannelHandler.handleRequest(MessageChannelHandler.java:209)  
at  
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:109)  
at  
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)  
at  
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
at  
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)  
at  
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)  
at  
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)  
at  
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)  
at  
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)  
at  
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)  
at  
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
at  
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)  
at  
org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:74)  
at  
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
at  
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)  
at  
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)  
at  
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)  
at  
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)  
at  
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)  
at  
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)  
at  
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)  
at  
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)  
at  
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)  
at  
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)  
at  
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
at java.lang.Thread.run(Thread.java:744)

I use  
Elasticsearch 0.9.10  
elasticsearch-carrot2 1.2.2  
used jars from elasticsearch-carrot2-1.2.0.zip

thx  
Petr

Dne středa, 5. března 2014 13:03:01 UTC+1 Dawid Weiss napsal(a):

> In short: yes. Perhaps the best way to check out how to use Java API  
> is to look at unit tests. For example:
> 
> [https://github.com/carrot2/elasticsearch-carrot2/blob/master/src/test/java/org/carrot2/elasticsearch/ClusteringActionTests.java#L65](https://github.com/carrot2/elasticsearch-carrot2/blob/master/src/test/java/org/carrot2/elasticsearch/ClusteringActionTests.java#L65)
> 
> I would also use a language code field and mapping for Czech; this  
> should improve your clustering results (especially if you tweak the  
> default lexical resources in Carrot2... patches welcome :).
> 
> [https://github.com/carrot2/elasticsearch-carrot2/blob/master/src/test/java/org/carrot2/elasticsearch/ClusteringActionTests.java#L100](https://github.com/carrot2/elasticsearch-carrot2/blob/master/src/test/java/org/carrot2/elasticsearch/ClusteringActionTests.java#L100)
> 
> Dawid
> 
> On Wed, Mar 5, 2014 at 10:53 AM, Petr Janský \<petr....@6hats.cz\<javascript:\>\>  
> wrote:
> 
> > Hello,
> > 
> > I use elasticsearch-carrot2 and I was not able to find how to get  
> > cluster  
> > result using JAVA API e.g. for
> > 
> > GET \_search\_with\_clusters?pretty=true  
> > {  
> > "query" : {  
> > "bool": {  
> > "must": [  
> > { "term": { "content": "zeman"}}  
> > ]  
> > }  
> > },  
> > "query\_hint": "vodafone",  
> > "field\_mapping": {  
> > "url": ["\_source.reference"],  
> > "title": ["\_source.title"],  
> > "content": ["\_source.content"]  
> > }  
> > }
> > 
> > result
> > 
> > {  
> > "took": 12,  
> > "timed\_out": false,  
> > "\_shards": {  
> > "total": 49,  
> > "successful": 49,  
> > "failed": 0  
> > },  
> > "hits": {  
> > "total": 2080562,  
> > "max\_score": 1,  
> > "hits": [.....]  
> > },  
> > "clusters": [  
> > {  
> > "id": 0,  
> > "score": 4.094963866819582,  
> > "label": "Možné Scénáře",  
> > "phrases": [  
> > "Možné Scénáře"  
> > ],  
> > "documents": [
> > 
> > "  
> > [http://www.denik.cz/z\_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114206](http://www.denik.cz/z_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114206)",
> 
> > "  
> > [http://www.denik.cz/z\_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114186](http://www.denik.cz/z_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114186)",
> 
> > "  
> > [http://www.denik.cz/z\_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114174](http://www.denik.cz/z_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114174)"
> 
> > ```
> > ] 
> > }, 
> > .... 
> > 
> > ```
> > 
> > ],  
> > "info": {  
> > "algorithm": "lingo",  
> > "search-millis": "11",  
> > "clustering-millis": "26",  
> > "total-millis": "38",  
> > "include-hits": "true"  
> > }  
> > }
> > 
> > is there any way how call this query using JAVA API?
> > 
> > Thx  
> > Petr
> > 
> > --  
> > 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](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit
> 
> [https://groups.google.com/d/msgid/elasticsearch/7a23e5a5-15ed-40be-80d9-fa93eebc28fe%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7a23e5a5-15ed-40be-80d9-fa93eebc28fe%40googlegroups.com).
> 
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/60764a12-9734-402d-8b07-54bb55082444%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/60764a12-9734-402d-8b07-54bb55082444%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Dawid\_Weiss](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dawid_weiss/32/1643_2.png) [@Dawid\_Weiss](https://discuss.elastic.co/u/Dawid_Weiss)\
**Post date:** [March 5, 2014, 1:12pm UTC](https://discuss.elastic.co/t/elasticsearch-carrot2-java-api-call/16166/4 "2014-03-05T13:12:55Z")

</div>

There is probably some inconsistency in your configuration -- the  
exception you're getting indicates you serialize with a different  
plugin version than serialize...

I just checked all the tests again and they pass. Make sure you have a  
consistent configuration.

Dawid

On Wed, Mar 5, 2014 at 1:32 PM, Petr Janský [petr.jansky@6hats.cz](mailto:petr.jansky@6hats.cz) wrote:

> Hi Dawid,
> 
> thank you for your reply. I tried the sample you sent me  
> [https://github.com/carrot2/elasticsearch-carrot2/blob/master/src/test/java/org/carrot2/elasticsearch/ClusteringActionTests.java#L65](https://github.com/carrot2/elasticsearch-carrot2/blob/master/src/test/java/org/carrot2/elasticsearch/ClusteringActionTests.java#L65)
> 
> but I got  
> Exception in thread "main"  
> org.elasticsearch.common.util.concurrent.UncategorizedExecutionException:  
> Failed execution  
> at  
> org.elasticsearch.action.support.AdapterActionFuture.rethrowExecutionException(AdapterActionFuture.java:88)  
> at  
> org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:49)  
> at  
> es.search.ClusteringActionTests.testAttributes(ClusteringActionTests.java:85)  
> at es.search.ClusteringActionTests.main(ClusteringActionTests.java:61)  
> Caused by: java.lang.ClassCastException: java.lang.Boolean cannot be cast to  
> java.util.Map  
> at  
> org.elasticsearch.common.io.stream.StreamInput.readMap(StreamInput.java:319)  
> at  
> org.carrot2.elasticsearch.ClusteringAction$ClusteringActionRequest.readFrom(ClusteringAction.java:407)  
> at  
> org.elasticsearch.transport.netty.MessageChannelHandler.handleRequest(MessageChannelHandler.java:209)  
> at  
> org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:109)  
> at  
> org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)  
> at  
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
> at  
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)  
> at  
> org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)  
> at  
> org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)  
> at  
> org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)  
> at  
> org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)  
> at  
> org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)  
> at  
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
> at  
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)  
> at  
> org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:74)  
> at  
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
> at  
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)  
> at  
> org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)  
> at  
> org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)  
> at  
> org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)  
> at  
> org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)  
> at  
> org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)  
> at  
> org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)  
> at  
> org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)  
> at  
> org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)  
> at  
> org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)  
> at  
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
> at java.lang.Thread.run(Thread.java:744)
> 
> I use  
> Elasticsearch 0.9.10  
> elasticsearch-carrot2 1.2.2  
> used jars from elasticsearch-carrot2-1.2.0.zip
> 
> thx  
> Petr
> 
> Dne středa, 5. března 2014 13:03:01 UTC+1 Dawid Weiss napsal(a):
> 
> > In short: yes. Perhaps the best way to check out how to use Java API  
> > is to look at unit tests. For example:
> > 
> > [https://github.com/carrot2/elasticsearch-carrot2/blob/master/src/test/java/org/carrot2/elasticsearch/ClusteringActionTests.java#L65](https://github.com/carrot2/elasticsearch-carrot2/blob/master/src/test/java/org/carrot2/elasticsearch/ClusteringActionTests.java#L65)
> > 
> > I would also use a language code field and mapping for Czech; this  
> > should improve your clustering results (especially if you tweak the  
> > default lexical resources in Carrot2... patches welcome :).
> > 
> > [https://github.com/carrot2/elasticsearch-carrot2/blob/master/src/test/java/org/carrot2/elasticsearch/ClusteringActionTests.java#L100](https://github.com/carrot2/elasticsearch-carrot2/blob/master/src/test/java/org/carrot2/elasticsearch/ClusteringActionTests.java#L100)
> > 
> > Dawid
> > 
> > On Wed, Mar 5, 2014 at 10:53 AM, Petr Janský [petr....@6hats.cz](mailto:petr....@6hats.cz) wrote:
> > 
> > > Hello,
> > > 
> > > I use elasticsearch-carrot2 and I was not able to find how to get  
> > > cluster  
> > > result using JAVA API e.g. for
> > > 
> > > GET \_search\_with\_clusters?pretty=true  
> > > {  
> > > "query" : {  
> > > "bool": {  
> > > "must": [  
> > > { "term": { "content": "zeman"}}  
> > > ]  
> > > }  
> > > },  
> > > "query\_hint": "vodafone",  
> > > "field\_mapping": {  
> > > "url": ["\_source.reference"],  
> > > "title": ["\_source.title"],  
> > > "content": ["\_source.content"]  
> > > }  
> > > }
> > > 
> > > result
> > > 
> > > {  
> > > "took": 12,  
> > > "timed\_out": false,  
> > > "\_shards": {  
> > > "total": 49,  
> > > "successful": 49,  
> > > "failed": 0  
> > > },  
> > > "hits": {  
> > > "total": 2080562,  
> > > "max\_score": 1,  
> > > "hits": [.....]  
> > > },  
> > > "clusters": [  
> > > {  
> > > "id": 0,  
> > > "score": 4.094963866819582,  
> > > "label": "Možné Scénáře",  
> > > "phrases": [  
> > > "Možné Scénáře"  
> > > ],  
> > > "documents": [
> > > 
> > > "[http://www.denik.cz/z\_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114206](http://www.denik.cz/z_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114206)",
> > > 
> > > "[http://www.denik.cz/z\_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114186](http://www.denik.cz/z_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114186)",
> > > 
> > > "[http://www.denik.cz/z\_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114174](http://www.denik.cz/z_domova/palestinsky-velvyslanec-zemrel-v-nemocnici-na-misto-jede-policejni-sef-cervicek.html#2114174)"  
> > > ]  
> > > },  
> > > ....  
> > > ],  
> > > "info": {  
> > > "algorithm": "lingo",  
> > > "search-millis": "11",  
> > > "clustering-millis": "26",  
> > > "total-millis": "38",  
> > > "include-hits": "true"  
> > > }  
> > > }
> > > 
> > > is there any way how call this query using JAVA API?
> > > 
> > > Thx  
> > > Petr
> > > 
> > > --  
> > > 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](mailto:elasticsearc...@googlegroups.com).  
> > > To view this discussion on the web visit
> > > 
> > > [https://groups.google.com/d/msgid/elasticsearch/7a23e5a5-15ed-40be-80d9-fa93eebc28fe%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7a23e5a5-15ed-40be-80d9-fa93eebc28fe%40googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/60764a12-9734-402d-8b07-54bb55082444%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/60764a12-9734-402d-8b07-54bb55082444%40googlegroups.com).
> 
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAM21Rt-AdHYKxiQktq9s0WGQN6R-qZzA%3DNfOQpPXqr7c6iF%3DRg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAM21Rt-AdHYKxiQktq9s0WGQN6R-qZzA%3DNfOQpPXqr7c6iF%3DRg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 1:45am UTC](https://discuss.elastic.co/t/elasticsearch-carrot2-java-api-call/16166/5 "2017-07-06T01:45:35Z")

</div>


