Thanks guys for your responses.

My question was due an strange behavior when using 'not' and 'geo_distance' 
filters.

I want to filter some results that have undesirable words, such as 'sex', 
'xxx', etc... And then geo filter those good results, but if I place 'not' 
filter first, then when geo filter is applied, it retrieves results with 
that not wanted words in it. If I place geo filter first, and then 'not' 
filter, geo filter seems not to be executed or something, because results 
are not accurate for that filter, instead, they still being good results 
with no bad words.

I am using it like this:


{
    "query": {
        "filtered": {
            "query": {...},
            "filter": [
                [{
                    "geo_distance": {
                        "distance": "30km",
                        "Location.location": {
                            "lat": "-32.890183",
                            "lon": "-68.844050"
                        }
                    }
                }],
                [{
                    "not": {
                        "filter": {
                            "query": {
                                "terms": {
                                    "_all": ["sex", "xxx", "sexshop"]
                                }
                            }
                        }
                    }
                }]
            ]
        }
    },
    "from": 0,
    "size": "10",
    "sort": {
        "_geo_distance": {
            "Location.location": {
                "lat": "-32.890183",
                "lon": "-68.844050",
                "order": "desc"
            }
        },
        "_score": "desc"
    }
}


It seems like the last filter is executed correctly.

Thanks,

Marce


El jueves, 16 de octubre de 2014 09:16:43 UTC-3, @mromagnoli escribió:
>
> Hi everyone, 
> I have a doubt about Filters. 
>
> If I have more than one filter, in a filtered query, are they executed in 
> the defined order? And, are they filtering in a 'chain' mode, i.e. using 
> the results of the previous filters?
>
> Thanks in advance as always.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/4ed1e0ad-9654-40a6-a48a-b753c102d0ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to