Hello,

I'm trying to figure out if it's possible to boost hits based on a regexp. 
For example, searching through records with user's names, I'd like to boost 
those that start with the query. I've tried a query like the following but 
it doesn't work like I'd like:

{
  "query": {
    "function_score": {
      "functions": [
        {
          "boost_factor": 2,
          "filter": {
            "regexp": {
              "name_not_analyzed": "^frank.*"
            }
          }
        }
      ],
      "score_mode": "multiply",
      "query": {
        "bool": {
          "must": [
            {
              "query_string": {
                "query": "frank",
                "default_operator": "AND"
              }
            },
            {
              "term": {
                "site_id": {
                  "term": 1
                }
              }
            }
          ]
        }
      }
    }
  }
}

Is this possible? If so, how? 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/8bb66f5f-7b98-4c22-b9d1-1254fa768ab4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to