Numeric range quey or filter in an array field - possible or not?


(Jens Christian Groh) #1

Hello together,

is an range query or filter possible if the field is an array?

Index looks like:

{
"name":"test1",
"numbers":[
11,23,13,16,17,23.6
]
},
{
"name":"test2",
"numbers":[
1,2,3,4,5,6,7,8,8.9,9.1,9.4
]
},
{
"name":"test3",
"numbers":[{
101,230,150,200
]
}

Is it possible to do a query like this:

{
"query" : {
"range" : {
"numbers" : {
"gt" : 10,
"lt" : 23.9
}
}
}
}

I tried it with a few tests but never got a result. So it would be nice to
know, if somebody has a clue if this works and i just made some mistakes.
Thanks

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #2

Would be nice if you could provide a full curl recreation as explained in help: http://www.elasticsearch.org/help/

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 22 oct. 2013 à 10:49, Jens Christian Groh groh@dtis.eu a écrit :

Hello together,

is an range query or filter possible if the field is an array?

Index looks like:

{
"name":"test1",
"numbers":[
11,23,13,16,17,23.6
]
},
{
"name":"test2",
"numbers":[
1,2,3,4,5,6,7,8,8.9,9.1,9.4
]
},
{
"name":"test3",
"numbers":[{
101,230,150,200
]
}

Is it possible to do a query like this:

{
"query" : {
"range" : {
"numbers" : {
"gt" : 10,
"lt" : 23.9
}
}
}
}

I tried it with a few tests but never got a result. So it would be nice to know, if somebody has a clue if this works and i just made some mistakes.
Thanks

--
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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.


(Jörg Prante) #3

Check this example https://gist.github.com/jprante/7099463 - it works here.

Jörg

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4