title: Order when searching for single value in a multi-value field in elasticsearch
body: <p>Example documents:</p>
  
  <pre><code>{"id": 1, "categories" : ["A", "C","E"]}
  {"id": 2, "categories" : ["A", "C"]}
  {"id": 3, "categories" : ["A"]}
  {"id": 4, "categories" : ["A"]}
  </code></pre>
  
  <p>When someone searches for a single value "A" in the <code>categories</code> field, how can I make sure that document 3 and 4 will always be in higher order than document 1 and 2 since they are closer to the single value "A"?</p>
  
  <p>I have tried this query:</p>
  
  <pre><code>{
      "query": {
        "bool": {
          "filter": {
            "bool": {
              "must": [
                {
                  "term": {
                    "categories": "A"
                  }
                }
              ]
            }
          }
        }
      }
    }
  </code></pre>
  
  <p>but document 3 and 4 are not in top order.</p>