Hi there

We've been using Elasticsearch for our main site search and it works a 
treat using geo-location searches and filters etc. But I can't seem to make 
it play nicely with percolator queries.

Here's an example of what we're trying to do...


This is an example document: -

{
    "_id": 156742,
    "_type": "",
    "_index": "",
    "_source": {
        "id": "156742",
        "thumb_id": null,
        "thumb_format": null,
        "advert_title": "Lovely rooms to rent in Writtle, Chelmsford",
        "advert_desc": "We have two lovely rooms. We have two lovely rooms. We 
have two lovely rooms. We have two lovely rooms. We have two lovely rooms. We 
have two lovely rooms. We have two lovely rooms. We have two lovely rooms. We 
have two lovely rooms. We have two lovely rooms. We have two lovely rooms. We 
have two lovely rooms. We have two lovely rooms. We have two lovely rooms. We 
have two lovely rooms. We have two lovely rooms. We have two lovely rooms. We 
have two lovely rooms. We have two lovely rooms.",
        "slug": "536E1ED90F4AD",
        "location": "51.7285690,0.4227900",
        "utilities": "0.00",
        "locality": "Writtle",
        "town": "Chelmsford",
        "county": "Essex",
        "postcode": "CM1 3LF",
        "outcode": "CM1",
        "created_at": "2014-05-10 13:43:05",
        "no_rooms": 2,
        "wanted_gender": "0",
        "wanted_orientation": "0",
        "couples_accepted": "2",
        "jsa_accepted": "2",
        "students_accepted": "2",
        "smokers_accepted": "2",
        "pets_allowed": "1",
        "parking_avail": "2",
        "whole_property": "1",
        "wanted_religion": "0",
        "featured": 0,
        "bold": 0,
        "site_id": "1",
        "moderated": "0",
        "rooms": [
            {
                "rent_pcm": "400.00",
                "rent": "400.00",
                "rent_type": "1",
                "deposit": "400.00",
                "room_size": "2",
                "furnished": "2",
                "bathroom": "1",
                "weekdays": "1",
                "avail_from": "2014-05-10"
            },
            {
                "rent_pcm": "400.00",
                "rent": "400.00",
                "rent_type": "1",
                "deposit": "400.00",
                "room_size": "2",
                "furnished": "2",
                "bathroom": "1",
                "weekdays": "1",
                "avail_from": "2014-05-10"
            }
        ]
    }
}



If I try this Percolator query I get a result

{
    "filtered": {
        "query": {
            "match_all": {}
        },
        "filter": {
            "and": [
                {
                    "geo_distance": {
                        "distance": "1miles",
                        "location": "51.7272680,0.4194800"
                    }
                }
            ]
        }
    }
}



However, as soon as I try to add additional filters, it stops returning the 
example document as a result, e.g. 

{
    "filtered": {
        "query": {
            "match_all": {}
        },
        "filter": {
            "and": [
                {
                    "geo_distance": {
                        "distance": "1miles",
                        "location": "51.7272680,0.4194800"
                    }
                },
                {
                    "or": [
                        {
                            "term": {
                                "site_id": 1
                            }
                        },
                        {
                            "and": [
                                {
                                    "not": {
                                        "filter": {
                                            "term": {
                                                "site_id": 1
                                            }
                                        }
                                    }
                                },
                                {
                                    "term": {
                                        "bold": 1
                                    }
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    }
}



Is anyone able to shed any light on this for me? I haven't a clue why it's 
not working!

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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/a5504b7a-ec47-4e6d-91bd-cbdb65411b5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to