jrkroeg
(jrkroeg)
March 17, 2015, 6:32pm
1
I'm trying to get the top 100 documents which match the filtered criteria,
and sort by distance from the pin.location.
Here's my query - which isn't resulting in error, but should be returning
results:
{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": [
{
"term": {
"searchTerm1": "N"
}
},
{
"term": {
"searchTerm2": "Y"
}
},
{
"term": {
"searchTerm3": "Y"
}
},
{
"term": {
"searchTerm4": "Y"
}
}
]
}
},
"sort": [
{
"_geo_distance": {
"pin.location": {
"lat": 34.073620,
"lon": -118.400356
},
"order": "asc",
"unit": "mi"
}
}
],
"size": 100
}
On a separate note, I'd like to find a way to make the filter more of a
suggestion, rather than forced - how would I achieve this?
--
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 .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/22379295-332d-4ebe-aef3-6c9b2326e755%40googlegroups.com .
For more options, visit https://groups.google.com/d/optout .
roger
(Roger)
March 17, 2015, 6:55pm
2
Look at this example on how to use multiple filters:
You should wrap them on a bool filter
2015-03-17 15:32 GMT-03:00 jrkroeg jrkroeg@gmail.com :
I'm trying to get the top 100 documents which match the filtered criteria,
and sort by distance from the pin.location.
Here's my query - which isn't resulting in error, but should be returning
results:
{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": [
{
"term": {
"searchTerm1": "N"
}
},
{
"term": {
"searchTerm2": "Y"
}
},
{
"term": {
"searchTerm3": "Y"
}
},
{
"term": {
"searchTerm4": "Y"
}
}
]
}
},
"sort": [
{
"_geo_distance": {
"pin.location": {
"lat": 34.073620,
"lon": -118.400356
},
"order": "asc",
"unit": "mi"
}
}
],
"size": 100
}
On a separate note, I'd like to find a way to make the filter more of a
suggestion, rather than forced - how would I achieve this?
--
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 .
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/22379295-332d-4ebe-aef3-6c9b2326e755%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/22379295-332d-4ebe-aef3-6c9b2326e755%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout .
--
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 .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAJp2533a5NcTmSnSYBDTJtmPpVk9a1vyiO9TZkYnPqdyP3TwnQ%40mail.gmail.com .
For more options, visit https://groups.google.com/d/optout .