Constant_scores w/ boost upon matching properties within nested

I have below as my mapping for some_index.

{
  "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.

"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?

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