Preferring length of value

Hi,
We have the following index:

    {
  "order": 0,
  "index_patterns": ["programs"],
  "settings": {
    "analysis": {
      "filter": {
        "autocomplete_filter": {
          "type": "edge_ngram",
          "min_gram": 2,
          "max_gram": 20
        }
      },
      "analyzer": {
        "autocomplete": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "autocomplete_filter"
          ]
        }
      }
    }
  },
  "mappings": {
    "program": {
      "properties": {
        "title": {
          "type": "text",
          "analyzer": "autocomplete",
          "search_analyzer": "standard"
        }        
      }
    }
  }
}

Problem is that we get the following order:
espnnfl
espnuk
espne60
...
..
...
espn

When we search:
"query": {
"multi_match": {
"query": 'espn',
"fields": [
"title"
],
"fuzziness": "auto"
}
}

How can we get ESPN first? we want to "boost" shorter and equal terms first

You can combine multiple queries within should clauses in a bool query.
This should work well. You can boost the exact match that way.

Thanks but how do I boost that?

Using the boost parameter.
Did you check the doc about it?

Got it query string - elasticsearch boost importance of exact phrase match - Stack Overflow

Thanks!

Actually BOOST isn't supported in match_phrase

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.