Hi All, I'm having some trouble bending the query api to my requirements on 
this one and was wondering if someone could point me in the right 
direction. 

We want to search some website content using the query string query. This 
needs to be filtered by various terms. However we need to boost a result if 
there is an exact match on the tags field. The tags field is an array of 
values, so this would be an exact match on 1 of the items in the array. 

I started with this query 

{
    "from": 0,
    "size": 20,
    "query": {
        "filtered": {
            "query": {
                "query_string": {
                    "fields": [
                        "title^2",
                        "body",
                        "file",
                        "summary",
                        "tags^10"
                    ],
                    "query": "Research Institute",
                    "use_dis_max": true
                }
            },
            "filter": {
                "bool": {
                    "must": [
                        {
                            "terms": {
                                "type": [
                                    "file",
                                    "page",
                                    "link",
                                    "folder",
                                    "calendar"
                                ]
                            }
                        }
                    ]
                }
            }
        }
    }
}

But this boosts items with the tag of just 'Research' as well as 'Research 
Institute' and ends up promoting some fairly irrelevant results. 

I thought of using a bool query with a filtered query element and a match 
query with a boost value, but ES wont execute that. Does anyone have any 
suggestions?

-- 
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/ae72db3d-b2c2-4651-ab5f-f9930c8796ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to