Java Api

Hi. There is very less documentation on Java api. I could not figure
out even how to build simple queries like termQuery. Can somebody
help ??

Show a working example

David :wink:

Le 2 juil. 2011 à 13:31, nachiket bhagwat nachiketbhagwat@gmail.com a écrit :

Hi. There is very less documentation on Java api. I could not figure
out even how to build simple queries like termQuery. Can somebody
help ??

Hi David. I have tried using the query you gave reference of. But it
is also not working. What I cant understand is how termQuery is
working without being part of any class. If it is part of a class how
termQuery("multi", "test") is running without initializing termquery
first.

On Jul 2, 4:36 pm, David Pilato da...@pilato.fr wrote:

Elasticsearch Platform — Find real-time answers at scale | Elastic

Show a working example

David :wink:

Le 2 juil. 2011 à 13:31, nachiket bhagwat nachiketbhag...@gmail.com a écrit :

Hi. There is very less documentation on Java api. I could not figure
out even how to build simple queries like termQuery. Can somebody
help ??

Ok I tried QueryBuilders.termQuery and it worked. But now it is
showing a different error.

SearchResponse response = client.prepareSearch("test")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(QueryBuilders.termQuery( "user" , "new"))
.setFrom(0).setSize(60).setExplain(true)) <<<- Error here.
Syntax error on token ")", delete this token
.execute()
.actionGet();

On Jul 2, 4:52 pm, nachiket bhagwat nachiketbhag...@gmail.com wrote:

Hi David. I have tried using the query you gave reference of. But it
is also not working. What I cant understand is how termQuery is
working without being part of any class. If it is part of a class how
termQuery("multi", "test") is running without initializing termquery
first.

On Jul 2, 4:36 pm, David Pilato da...@pilato.fr wrote:

Elasticsearch Platform — Find real-time answers at scale | Elastic

Show a working example

David :wink:

Le 2 juil. 2011 à 13:31, nachiket bhagwat nachiketbhag...@gmail.com a écrit :

Hi. There is very less documentation on Java api. I could not figure
out even how to build simple queries like termQuery. Can somebody
help ??

Hi,

Do what it says.. delete the ")" bracket, there is a bracket mismatch! I am
also new to es, and it is true that there could be more documentation of the
Java API, and I too struggled a bit initially with it, but it is actually
not that difficult to figure it out, knowing that the REST API internally
uses the Java API. Just compare the Java API examples side-by-side with the
corresponding REST API and you'll see the pattern.

Hari

On Sat, Jul 2, 2011 at 5:31 PM, nachiket bhagwat
nachiketbhagwat@gmail.comwrote:

Ok I tried QueryBuilders.termQuery and it worked. But now it is
showing a different error.

SearchResponse response = client.prepareSearch("test")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(QueryBuilders.termQuery( "user" , "new"))
.setFrom(0).setSize(60).setExplain(true)) <<<- Error here.
Syntax error on token ")", delete this token
.execute()
.actionGet();

On Jul 2, 4:52 pm, nachiket bhagwat nachiketbhag...@gmail.com wrote:

Hi David. I have tried using the query you gave reference of. But it
is also not working. What I cant understand is how termQuery is
working without being part of any class. If it is part of a class how
termQuery("multi", "test") is running without initializing termquery
first.

On Jul 2, 4:36 pm, David Pilato da...@pilato.fr wrote:

Elasticsearch Platform — Find real-time answers at scale | Elastic

Show a working example

David :wink:

Le 2 juil. 2011 à 13:31, nachiket bhagwat nachiketbhag...@gmail.com
a écrit :

Hi. There is very less documentation on Java api. I could not figure
out even how to build simple queries like termQuery. Can somebody
help ??