DSL: query + numeric range filter + sort

Hi there,

How exactly would a DSL query look if it contained both a query (that
contains anything, e.g. "dt:123456 user:john login -200") and a
numeric_range on the dt field.

There's no need for scoring, but there is for sorting (on the "dt" field
descending).

Should I use this one?
http://www.elasticsearch.org/guide/reference/query-dsl/query-filter.html

If so, could anyone provide an example of my use case?

Thank you in advance!

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E robin@us2.nl

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments is
intended solely for the attention and use of the named addressee and may be
confidential. If you are not the intended recipient, you are reminded that
the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

--

Hi Robin,

Couple of options for how to do this.

If your numeric_range is a pretty static value (and consequently would
benefit from caching), I recommend you make use
of Elasticsearch Platform — Find real-time answers at scale | Elastic.
Put your query_string as the query, and the numeric_range as a range
filter, much like the example shows.

Alternatively if you don't want to use a filter, you could simple use
a Elasticsearch Platform — Find real-time answers at scale | Elastic
with your query as one clause and your range as another.

At any stage if you want to skip scoring, you can wrap a query in
a Elasticsearch Platform — Find real-time answers at scale | Elastic.

On Friday, November 16, 2012 7:57:11 AM UTC+13, Robin Verlangen wrote:

Hi there,

How exactly would a DSL query look if it contained both a query (that
contains anything, e.g. "dt:123456 user:john login -200") and a
numeric_range on the dt field.

There's no need for scoring, but there is for sorting (on the "dt" field
descending).

Should I use this one?
Elasticsearch Platform — Find real-time answers at scale | Elastic

If so, could anyone provide an example of my use case?

Thank you in advance!

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E ro...@us2.nl <javascript:>

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments is
intended solely for the attention and use of the named addressee and may be
confidential. If you are not the intended recipient, you are reminded that
the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

--

Hi Chris,

Have been struggling with this for a couple of days, but can't get it
right. Could you please give me an example (something that works when I
fire it copy/past into a req. body)? I think I miss something fundamental.

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E robin@us2.nl

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments is
intended solely for the attention and use of the named addressee and may be
confidential. If you are not the intended recipient, you are reminded that
the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

On Thu, Nov 15, 2012 at 10:43 PM, Chris Male gento0nz@gmail.com wrote:

Hi Robin,

Couple of options for how to do this.

If your numeric_range is a pretty static value (and consequently would
benefit from caching), I recommend you make use of
Elasticsearch Platform — Find real-time answers at scale | Elastic.
Put your query_string as the query, and the numeric_range as a range
filter, much like the example shows.

Alternatively if you don't want to use a filter, you could simple use a
Elasticsearch Platform — Find real-time answers at scale | Elastic your query as one clause and your range as another.

At any stage if you want to skip scoring, you can wrap a query in a
Elasticsearch Platform — Find real-time answers at scale | Elastic
.

On Friday, November 16, 2012 7:57:11 AM UTC+13, Robin Verlangen wrote:

Hi there,

How exactly would a DSL query look if it contained both a query (that
contains anything, e.g. "dt:123456 user:john login -200") and a
numeric_range on the dt field.

There's no need for scoring, but there is for sorting (on the "dt" field
descending).

Should I use this one? http://www.elasticsearch.**
org/guide/reference/query-dsl/**query-filter.htmlhttp://www.elasticsearch.org/guide/reference/query-dsl/query-filter.html

If so, could anyone provide an example of my use case?

Thank you in advance!

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E ro...@us2.nl

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments is
intended solely for the attention and use of the named addressee and may be
confidential. If you are not the intended recipient, you are reminded that
the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

--

--

The numeric range is like this:

{"query":{"constant_score":{"filter":{"numeric_range":{"dt":{"from":0,"to":1353363346}}}}}}

However I have no idea how to add the query string to this structure: when
I change something it doesn't turn any response and the log is empty. For
example:

{"query":{"constant_score":{"filter":{"numeric_range":{"dt":{"from":0,"to":1353363459}}},"query":{"query_string":{"_all":"*"}}}}}

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E robin@us2.nl

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments is
intended solely for the attention and use of the named addressee and may be
confidential. If you are not the intended recipient, you are reminded that
the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

On Mon, Nov 19, 2012 at 9:40 PM, Robin Verlangen robin@us2.nl wrote:

Hi Chris,

Have been struggling with this for a couple of days, but can't get it
right. Could you please give me an example (something that works when I
fire it copy/past into a req. body)? I think I miss something fundamental.

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E robin@us2.nl

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments is
intended solely for the attention and use of the named addressee and may be
confidential. If you are not the intended recipient, you are reminded that
the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

On Thu, Nov 15, 2012 at 10:43 PM, Chris Male gento0nz@gmail.com wrote:

Hi Robin,

Couple of options for how to do this.

If your numeric_range is a pretty static value (and consequently would
benefit from caching), I recommend you make use of
Elasticsearch Platform — Find real-time answers at scale | Elastic.
Put your query_string as the query, and the numeric_range as a range
filter, much like the example shows.

Alternatively if you don't want to use a filter, you could simple use a
Elasticsearch Platform — Find real-time answers at scale | Elastic your query as one clause and your range as another.

At any stage if you want to skip scoring, you can wrap a query in a
Elasticsearch Platform — Find real-time answers at scale | Elastic
.

On Friday, November 16, 2012 7:57:11 AM UTC+13, Robin Verlangen wrote:

Hi there,

How exactly would a DSL query look if it contained both a query (that
contains anything, e.g. "dt:123456 user:john login -200") and a
numeric_range on the dt field.

There's no need for scoring, but there is for sorting (on the "dt" field
descending).

Should I use this one? http://www.elasticsearch.**
org/guide/reference/query-dsl/**query-filter.htmlhttp://www.elasticsearch.org/guide/reference/query-dsl/query-filter.html

If so, could anyone provide an example of my use case?

Thank you in advance!

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E ro...@us2.nl

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments is
intended solely for the attention and use of the named addressee and may be
confidential. If you are not the intended recipient, you are reminded that
the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

--

--

Hi Robin,

I just threw together an example which you'll need to edit to meet your
needs, ElasticSearch DSL and NumericRangeQuery · GitHub.

On Tuesday, November 20, 2012 11:18:14 AM UTC+13, Robin Verlangen wrote:

The numeric range is like this:

{"query":{"constant_score":{"filter":{"numeric_range":{"dt":{"from":0,"to":1353363346}}}}}}

However I have no idea how to add the query string to this structure: when
I change something it doesn't turn any response and the log is empty. For
example:

{"query":{"constant_score":{"filter":{"numeric_range":{"dt":{"from":0,"to":1353363459}}},"query":{"query_string":{"_all":"*"}}}}}

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E ro...@us2.nl <javascript:>

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments is
intended solely for the attention and use of the named addressee and may be
confidential. If you are not the intended recipient, you are reminded that
the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

On Mon, Nov 19, 2012 at 9:40 PM, Robin Verlangen <ro...@us2.nl<javascript:>

wrote:

Hi Chris,

Have been struggling with this for a couple of days, but can't get it
right. Could you please give me an example (something that works when I
fire it copy/past into a req. body)? I think I miss something fundamental.

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E ro...@us2.nl <javascript:>

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments is
intended solely for the attention and use of the named addressee and may be
confidential. If you are not the intended recipient, you are reminded that
the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

On Thu, Nov 15, 2012 at 10:43 PM, Chris Male <gent...@gmail.com<javascript:>

wrote:

Hi Robin,

Couple of options for how to do this.

If your numeric_range is a pretty static value (and consequently would
benefit from caching), I recommend you make use of
Elasticsearch Platform — Find real-time answers at scale | Elastic.
Put your query_string as the query, and the numeric_range as a range
filter, much like the example shows.

Alternatively if you don't want to use a filter, you could simple use a
Elasticsearch Platform — Find real-time answers at scale | Elastic your query as one clause and your range as another.

At any stage if you want to skip scoring, you can wrap a query in a
Elasticsearch Platform — Find real-time answers at scale | Elastic
.

On Friday, November 16, 2012 7:57:11 AM UTC+13, Robin Verlangen wrote:

Hi there,

How exactly would a DSL query look if it contained both a query (that
contains anything, e.g. "dt:123456 user:john login -200") and a
numeric_range on the dt field.

There's no need for scoring, but there is for sorting (on the "dt"
field descending).

Should I use this one? http://www.elasticsearch.**
org/guide/reference/query-dsl/**query-filter.htmlhttp://www.elasticsearch.org/guide/reference/query-dsl/query-filter.html

If so, could anyone provide an example of my use case?

Thank you in advance!

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E ro...@us2.nl

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments
is intended solely for the attention and use of the named addressee and may
be confidential. If you are not the intended recipient, you are reminded
that the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

--

--

Hi Chris,

That doesn't work for me:
{
"filtered": {
"query": {
"query_string": {
"query": "test and asdf"
}
},
"filter": {
"numeric_range": {
"from": "0",
"to": "1353431826"
}
}
}
}

Error in the log:

[2012-11-20 18:14:13,265][DEBUG][action.search.type ] [Aardwolf]
[2012-11-20][3], node[l8EnaTstTMeyBZfGXL3viA], [P], s[STARTED]: Failed to
execute [org.elasticsearch.action.search.SearchRequest@7fde81b5]
org.elasticsearch.search.SearchParseException: [2012-11-20][3]:
from[-1],size[-1]: Parse Failure [Failed to parse source [{
"filtered" : {
"query" : {
"query_string" : {
"query" : "*"
}
},
"filter" : {
"numeric_range" : {
"from" : "0",
"to" : "1353431653"
}
}
}
}
]]
at
org.elasticsearch.search.SearchService.parseSource(SearchService.java:554)
at
org.elasticsearch.search.SearchService.createContext(SearchService.java:469)
at
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:228)
at
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:140)
at
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:205)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:192)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:178)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.elasticsearch.search.SearchParseException: [2012-11-20][3]:
from[-1],size[-1]: Parse Failure [No parser for element [filtered]]
at
org.elasticsearch.search.SearchService.parseSource(SearchService.java:540)
... 10 more

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E robin@us2.nl

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments is
intended solely for the attention and use of the named addressee and may be
confidential. If you are not the intended recipient, you are reminded that
the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

On Tue, Nov 20, 2012 at 4:27 AM, Chris Male gento0nz@gmail.com wrote:

Hi Robin,

I just threw together an example which you'll need to edit to meet your
needs, ElasticSearch DSL and NumericRangeQuery · GitHub.

On Tuesday, November 20, 2012 11:18:14 AM UTC+13, Robin Verlangen wrote:

The numeric range is like this:

{"query":{"constant_score":{"filter":{"numeric_range":{"dt"
:{"from":0,"to":1353363346}}}}**}}

However I have no idea how to add the query string to this structure:
when I change something it doesn't turn any response and the log is empty.
For example:

{"query":{"constant_score":{"filter":{"numeric_range":{"dt"
:{"from":0,"to":1353363459}}},"query":{"query_string":{"_
all":"*"}}}}}

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E ro...@us2.nl

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments is
intended solely for the attention and use of the named addressee and may be
confidential. If you are not the intended recipient, you are reminded that
the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

On Mon, Nov 19, 2012 at 9:40 PM, Robin Verlangen ro...@us2.nl wrote:

Hi Chris,

Have been struggling with this for a couple of days, but can't get it
right. Could you please give me an example (something that works when I
fire it copy/past into a req. body)? I think I miss something fundamental.

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E ro...@us2.nl

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments is
intended solely for the attention and use of the named addressee and may be
confidential. If you are not the intended recipient, you are reminded that
the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

On Thu, Nov 15, 2012 at 10:43 PM, Chris Male gent...@gmail.com wrote:

Hi Robin,

Couple of options for how to do this.

If your numeric_range is a pretty static value (and consequently would
benefit from caching), I recommend you make use of
http://www.elasticsearch.org/guide/reference/query-dsl/
filtered-query.htmlhttp://www.elasticsearch.org/guide/reference/query-dsl/filtered-query.html.
Put your query_string as the query, and the numeric_range as a range
filter, much like the example shows.

Alternatively if you don't want to use a filter, you could simple use a
http://www.elasticsearch.org/guide/reference/query-dsl/
bool-query.htmlhttp://www.elasticsearch.org/guide/reference/query-dsl/bool-query.htmlwith your query as one clause and your range as another.

At any stage if you want to skip scoring, you can wrap a query in a
http://www.elasticsearch.org/guide/reference/query-dsl/
constant-score-query.htmlhttp://www.elasticsearch.org/guide/reference/query-dsl/constant-score-query.html
.

On Friday, November 16, 2012 7:57:11 AM UTC+13, Robin Verlangen wrote:

Hi there,

How exactly would a DSL query look if it contained both a query (that
contains anything, e.g. "dt:123456 user:john login -200") and a
numeric_range on the dt field.

There's no need for scoring, but there is for sorting (on the "dt"
field descending).

Should I use this one? http://www.elasticsearch.****
org/guide/reference/query-dsl/****query-filter.htmlhttp://www.elasticsearch.org/guide/reference/query-dsl/query-filter.html

If so, could anyone provide an example of my use case?

Thank you in advance!

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E ro...@us2.nl

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments
is intended solely for the attention and use of the named addressee and may
be confidential. If you are not the intended recipient, you are reminded
that the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

--

--

--

Finally fixed it, thank you for your time Chris!

{
"query": {
"filtered": {
"filter": {
"numeric_range": {
"dt": {
"from": 0,
"to": 1353432703
}
}
},
"query": {
"query_string": {
"query": "*"
}
}
}
}
}

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E robin@us2.nl

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments is
intended solely for the attention and use of the named addressee and may be
confidential. If you are not the intended recipient, you are reminded that
the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

On Tue, Nov 20, 2012 at 6:18 PM, Robin Verlangen robin@us2.nl wrote:

Hi Chris,

That doesn't work for me:
{
"filtered": {
"query": {
"query_string": {
"query": "test and asdf"
}
},
"filter": {
"numeric_range": {
"from": "0",
"to": "1353431826"
}
}
}
}

Error in the log:

[2012-11-20 18:14:13,265][DEBUG][action.search.type ] [Aardwolf]
[2012-11-20][3], node[l8EnaTstTMeyBZfGXL3viA], [P], s[STARTED]: Failed to
execute [org.elasticsearch.action.search.SearchRequest@7fde81b5]
org.elasticsearch.search.SearchParseException: [2012-11-20][3]:
from[-1],size[-1]: Parse Failure [Failed to parse source [{
"filtered" : {
"query" : {
"query_string" : {
"query" : "*"
}
},
"filter" : {
"numeric_range" : {
"from" : "0",
"to" : "1353431653"
}
}
}
}
]]
at
org.elasticsearch.search.SearchService.parseSource(SearchService.java:554)
at
org.elasticsearch.search.SearchService.createContext(SearchService.java:469)
at
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:228)
at
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:140)
at
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:205)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:192)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:178)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.elasticsearch.search.SearchParseException: [2012-11-20][3]:
from[-1],size[-1]: Parse Failure [No parser for element [filtered]]
at
org.elasticsearch.search.SearchService.parseSource(SearchService.java:540)
... 10 more

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E robin@us2.nl

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments is
intended solely for the attention and use of the named addressee and may be
confidential. If you are not the intended recipient, you are reminded that
the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

On Tue, Nov 20, 2012 at 4:27 AM, Chris Male gento0nz@gmail.com wrote:

Hi Robin,

I just threw together an example which you'll need to edit to meet your
needs, ElasticSearch DSL and NumericRangeQuery · GitHub.

On Tuesday, November 20, 2012 11:18:14 AM UTC+13, Robin Verlangen wrote:

The numeric range is like this:

{"query":{"constant_score":{"filter":{"numeric_range":{"dt"
:{"from":0,"to":1353363346}}}}**}}

However I have no idea how to add the query string to this structure:
when I change something it doesn't turn any response and the log is empty.
For example:

{"query":{"constant_score":{"filter":{"numeric_range":{"dt"
:{"from":0,"to":1353363459}}},"query":{"query_string":{"_
all":"*"}}}}}

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E ro...@us2.nl

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments is
intended solely for the attention and use of the named addressee and may be
confidential. If you are not the intended recipient, you are reminded that
the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

On Mon, Nov 19, 2012 at 9:40 PM, Robin Verlangen ro...@us2.nl wrote:

Hi Chris,

Have been struggling with this for a couple of days, but can't get it
right. Could you please give me an example (something that works when I
fire it copy/past into a req. body)? I think I miss something fundamental.

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E ro...@us2.nl

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments
is intended solely for the attention and use of the named addressee and may
be confidential. If you are not the intended recipient, you are reminded
that the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

On Thu, Nov 15, 2012 at 10:43 PM, Chris Male gent...@gmail.com wrote:

Hi Robin,

Couple of options for how to do this.

If your numeric_range is a pretty static value (and consequently would
benefit from caching), I recommend you make use of
http://www.elasticsearch.org/guide/reference/query-dsl/
filtered-query.htmlhttp://www.elasticsearch.org/guide/reference/query-dsl/filtered-query.html.
Put your query_string as the query, and the numeric_range as a range
filter, much like the example shows.

Alternatively if you don't want to use a filter, you could simple use
a http://www.elasticsearch.org/guide/reference/query-dsl/
bool-query.htmlhttp://www.elasticsearch.org/guide/reference/query-dsl/bool-query.htmlwith your query as one clause and your range as another.

At any stage if you want to skip scoring, you can wrap a query in a
http://www.elasticsearch.org/guide/reference/query-dsl/
constant-score-query.htmlhttp://www.elasticsearch.org/guide/reference/query-dsl/constant-score-query.html
.

On Friday, November 16, 2012 7:57:11 AM UTC+13, Robin Verlangen wrote:

Hi there,

How exactly would a DSL query look if it contained both a query (that
contains anything, e.g. "dt:123456 user:john login -200") and a
numeric_range on the dt field.

There's no need for scoring, but there is for sorting (on the "dt"
field descending).

Should I use this one? http://www.elasticsearch.****
org/guide/reference/query-dsl/****query-filter.htmlhttp://www.elasticsearch.org/guide/reference/query-dsl/query-filter.html

If so, could anyone provide an example of my use case?

Thank you in advance!

Best regards,

Robin Verlangen
Software engineer
*
*
W http://www.robinverlangen.nl
E ro...@us2.nl

http://goo.gl/Lt7BC

Disclaimer: The information contained in this message and attachments
is intended solely for the attention and use of the named addressee and may
be confidential. If you are not the intended recipient, you are reminded
that the information remains the property of the sender. You must not use,
disclose, distribute, copy, print or rely on this e-mail. If you have
received this message in error, please contact the sender immediately and
irrevocably delete this message and any copies.

--

--

--