# Additional score if field match but not include in results

**URL:** https://discuss.elastic.co/t/additional-score-if-field-match-but-not-include-in-results/53934
**Category:** Elasticsearch
**Created:** [June 25, 2016, 7:12am UTC](https://discuss.elastic.co/t/additional-score-if-field-match-but-not-include-in-results/53934 "2016-06-25T07:12:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mac2000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mac2000/32/1531_2.png) [@mac2000](https://discuss.elastic.co/u/mac2000)
#### Post date: [June 25, 2016, 7:12am UTC](https://discuss.elastic.co/t/additional-score-if-field-match-but-not-include-in-results/53934/1 "2016-06-25T07:12:05Z")

</div>

Hello, I am trying to find a way to make following:

```auto
DELETE /sample

POST /sample/post/1
{
  "title": "php",
  "tags": ["php"],
  "content": "php is a scripting language"
}

POST /sample/post/2
{
  "title": "wordpress",
  "tags": ["wordpress", "php"],
  "content": "wordpress is a blog cms"
}

POST /sample/post/3
{
  "title": "python",
  "tags": ["python"],
  "content": "python is a scripting language like php"
}

POST /sample/post/_search
{
  "query": {
    "filtered": {
      "query": {
        "bool": {
          "should": [
            {
              "match": {
                "title": "php"
              }
            },
            {
              "match": {
                "tags": "php"
              }
            }
          ]
        }
      },
      "filter": {}
    }
  }
}

```

We are searching documents by `title` and `tags`, but want to score those documents that have matches inside `content` higher, without including them in search results

What I mean is that if we will add one more match for `content` inside bool query we will get 3 docs instead of 2, and the 3rd one will be about python which is not desirable. If we will add `minimum_should_match: 2` we wont receive wordpress document which is also undesirable.

May be someone will be able to help achieve desired behaviour

---

<div class="post-metadata">

### Author: ![mac2000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mac2000/32/1531_2.png) [@mac2000](https://discuss.elastic.co/u/mac2000)
#### Post date: [June 25, 2016, 7:19am UTC](https://discuss.elastic.co/t/additional-score-if-field-match-but-not-include-in-results/53934/2 "2016-06-25T07:19:04Z")

</div>

The only way it seems to make it possible is something like this:

```auto
POST /sample/post/_search
{
  "query": {
    "filtered": {
      "query": {
        "bool": {
          "should": [
            {
              "match": {
                "title": "php"
              }
            },
            {
              "match": {
                "tags": "php"
              }
            },
            {
              "match": {
                "content": "php"
              }
            }
          ]
        }
      },
      "filter": {
        "query": {
          "bool": {
            "should": [
              {
                "match": {
                  "title": "php"
                }
              },
              {
                "match": {
                  "tags": "php"
                }
              }
            ]
          }
        }
      }
    }
  }
}

```

But not sure is it a good idea to do such things, e.g. we are performing multiple queries

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 5, 2017, 10:40pm UTC](https://discuss.elastic.co/t/additional-score-if-field-match-but-not-include-in-results/53934/3 "2017-07-05T22:40:35Z")

</div>


