Custom plugin Java client query - Carrot2


(Nicom Nicom) #1

Hi,

I've successfully installed Carrot2 plugin
(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
-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.


(Mohit Chawla) #2

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 wrote:

Hi,

I've successfully installed Carrot2 plugin
(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
-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.


(system) #3