title: how to search for tags in elasticsearch
body: <p>I am creating search for photo gallery project where photos could have upto 50 tags (just like in shutterstock and fotolia). I am creating my search in elasticsearch. I have a field with datatype keyword in elasticsearch. When query comes like "Abstract Background", I want to search for abstract and background in all the keywords of the images and sort them by their relevancy. It should not match abstr backgrou. I wrote a query like this</p>
  
  <pre><code> "query": {
      "bool": {
        "should": [
          {
            "match": {
              "keyword": {
                "query": "abstract, background"
              }
            }
          }
        ]
      }
    }
  </code></pre>
  
  <p>It only works for matching single keywords. I want to match for multiple keywords and also sort them by their relevancy. Thanks</p>
  
  <p>-----EDIT------</p>
  
  <p>These are my mappings.
  Title field works fine. Category is just used for aggregations and keyword is the main field to match.</p>
  
  <pre><code>PUT /freevects
  {
    "mappings": {
      "photos": {
        "properties": {
          "title": {
            "type": "text",
            "boost": 1.9,
            "analyzer": "standard"
          },
          "keyword": {
            "type": "keyword",
            "boost": 1.4
          },
          "category": {
            "type": "keyword",
            "index": false
          },
          "quality": {
            "type": "short",
            "index": false,
            "boost": 1.1
          },
          "downloads": {
            "type": "integer",
            "index": false,
            "boost": 1.1
          },
          "likes": {
            "type": "integer",
            "index": false,
            "boost": 1
          },
          "filename": {
            "type": "keyword",
            "index": false
          },
          "type": {
            "type": "keyword",
            "index": false
          },
          "free": {
            "type": "short",
            "index": false
          },
          "created": {
            "type": "date",
            "index": false
          }
        }
      }
    }
  }
  </code></pre>