# Constant\_scores w/ boost upon matching properties within nested

**URL:** <https://discuss.elastic.co/t/constant-scores-w-boost-upon-matching-properties-within-nested/315930>\
**Category:** Elasticsearch\
**Created:** [October 6, 2022, 4:14am UTC](https://discuss.elastic.co/t/constant-scores-w-boost-upon-matching-properties-within-nested/315930 "2022-10-06T04:14:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Kim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul_kim/32/100267_2.png) [@Paul\_Kim](https://discuss.elastic.co/u/Paul_Kim)\
**Post date:** [October 6, 2022, 4:14am UTC](https://discuss.elastic.co/t/constant-scores-w-boost-upon-matching-properties-within-nested/315930/1 "2022-10-06T04:14:17Z")

</div>

I have below as my mapping for some\_index.

```auto
{
  "some_index":
    "properties": {
        "people": {
          "type": "nested",
          "properties": {
            "name": {
              "type": "keyword"
            },
            "job": {
              "type": "keyword"
            }
          }
        }
    }
}

```

Ideally data would be saved as  
{  
...other properties,  
people: [{"level": "l5", "job": "programmer"},{"level": "l3", "job": "programmer"} ...]  
}  
What I am trying to do is boost scores when search query includes properties in people such that people with level and job match show on top of the list from query result.

```auto
"should": [
                {
                    "constant_score": {
                        "filter": {
                            "terms": {
                                "people": [
                                    {
                                        "level": "l2"
                                        "job": "programmer",

                                    },
                                    {
                                        "level": "l3",
                                        "job": "cs"
                                    }
                                ]
                            }
                        },
                        "boost": 100
                    }
                }
            ]
        }
    } ...

```

This query however don't seem to have any effect at all. I've tried some other way with match and others, but did not get what I wanted.

Possible solution to this?

---

<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:** [November 3, 2022, 4:14am UTC](https://discuss.elastic.co/t/constant-scores-w-boost-upon-matching-properties-within-nested/315930/2 "2022-11-03T04:14:41Z")

</div>

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