Learning the Query DSL

The documentation is a bit sparse on describing the query capabilities. Is
there a recommended online source to get familiar with Elastic Search's
syntax and terminology? Would looking into Lucene resources help?

Can you give some examples as to what you are missing? Is that how query
behave, or maybe how to construct them (using JSON for example)?

On Mon, Jul 12, 2010 at 10:57 PM, James Cook jcook@tracermedia.com wrote:

The documentation is a bit sparse on describing the query capabilities. Is
there a recommended online source to get familiar with Elastic Search's
syntax and terminology? Would looking into Lucene resources help?

There is just the terminology hurdles which I have been able to get
over using the Lucene documentation (diff between term and field, what
is boost, etc..).

But I would appreciate an example that shows how to query an index
when presented with a JSON object, but from the Java API.

Thanks.

On Jul 12, 4:22 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Can you give some examples as to what you are missing? Is that how query
behave, or maybe how to construct them (using JSON for example)?

On Mon, Jul 12, 2010 at 10:57 PM, James Cook jc...@tracermedia.com wrote:

The documentation is a bit sparse on describing the query capabilities. Is
there a recommended online source to get familiar with Elastic Search's
syntax and terminology? Would looking into Lucene resources help?

That should read:

"But I would appreciate an example that shows how to query an index
when presented with a JSON String, but from the Java API."

I have tried:
var source = JSON.stringify(json);
source = searchSource().query(new
QueryStringQueryBuilder(source)).buildAsBytes();
var request = searchRequest(index).types(types).source(source);
var response = getClient().search(request).actionGet();

But I get these parser exceptions:
00:53:45,455 ERROR 47115-26 rest: ? -
Error while processing request: /api/test/hazel, error: JavaException:
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute [query] total failure; shardFailures {null:
RemoteTransportException[[Antonio][inet[/127.0.0.1:9310]][search/phase/query]];
nested:
NotSerializableTransportException[[org.elasticsearch.search.SearchParseException]
[nep][4]: query[null],from[-1],size[-1]: Parse Failure [Failed to parse
[{"query":{"query_string":{"query":"{"field":{"patient.lastname":"Cook"}}"}}}]];
[nep] Failed to parse query [{"field":{"patient.lastname":"Cook"}}]; Cannot
parse '{"field":{"patient.lastname":"Cook"}}': Encountered " "}" "} "" at
line 1, column 35.
Was expecting one of:
"TO" ...
<RANGEEX_QUOTED> ...
<RANGEEX_GOOP> ...
; Encountered " "}" "} "" at line 1, column 35.
Was expecting one of:
"TO" ...
<RANGEEX_QUOTED> ...
<RANGEEX_GOOP> ...

On Mon, Jul 12, 2010 at 11:32 PM, oravecz jcook@tracermedia.com wrote:

There is just the terminology hurdles which I have been able to get
over using the Lucene documentation (diff between term and field, what
is boost, etc..).

But I would appreciate an example that shows how to query an index
when presented with a JSON object, but from the Java API.

Thanks.

On Jul 12, 4:22 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Can you give some examples as to what you are missing? Is that how query
behave, or maybe how to construct them (using JSON for example)?

On Mon, Jul 12, 2010 at 10:57 PM, James Cook jc...@tracermedia.com
wrote:

The documentation is a bit sparse on describing the query capabilities.
Is
there a recommended online source to get familiar with Elastic Search's
syntax and terminology? Would looking into Lucene resources help?

If you have the full search request represented as JSON (with the "query"
top level element), then just pass that json (as string or bytes) to
SearchRequest#source(...).

-shay.banon

On Tue, Jul 13, 2010 at 7:55 AM, James Cook jcook@tracermedia.com wrote:

That should read:

"But I would appreciate an example that shows how to query an index
when presented with a JSON String, but from the Java API."

I have tried:
var source = JSON.stringify(json);
source = searchSource().query(new
QueryStringQueryBuilder(source)).buildAsBytes();
var request = searchRequest(index).types(types).source(source);
var response = getClient().search(request).actionGet();

But I get these parser exceptions:
00:53:45,455 ERROR 47115-26 rest: ? -
Error while processing request: /api/test/hazel, error: JavaException:
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute [query] total failure; shardFailures {null:
RemoteTransportException[[Antonio][inet[/127.0.0.1:9310]][search/phase/query]];
nested:
NotSerializableTransportException[[org.elasticsearch.search.SearchParseException]
[nep][4]: query[null],from[-1],size[-1]: Parse Failure [Failed to parse
[{"query":{"query_string":{"query":"{"field":{"patient.lastname":"Cook"}}"}}}]];
[nep] Failed to parse query [{"field":{"patient.lastname":"Cook"}}]; Cannot
parse '{"field":{"patient.lastname":"Cook"}}': Encountered " "}" "} "" at
line 1, column 35.
Was expecting one of:
"TO" ...
<RANGEEX_QUOTED> ...
<RANGEEX_GOOP> ...
; Encountered " "}" "} "" at line 1, column 35.
Was expecting one of:
"TO" ...
<RANGEEX_QUOTED> ...
<RANGEEX_GOOP> ...

On Mon, Jul 12, 2010 at 11:32 PM, oravecz jcook@tracermedia.com wrote:

There is just the terminology hurdles which I have been able to get
over using the Lucene documentation (diff between term and field, what
is boost, etc..).

But I would appreciate an example that shows how to query an index
when presented with a JSON object, but from the Java API.

Thanks.

On Jul 12, 4:22 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Can you give some examples as to what you are missing? Is that how query
behave, or maybe how to construct them (using JSON for example)?

On Mon, Jul 12, 2010 at 10:57 PM, James Cook jc...@tracermedia.com
wrote:

The documentation is a bit sparse on describing the query
capabilities. Is
there a recommended online source to get familiar with Elastic
Search's
syntax and terminology? Would looking into Lucene resources help?