How to access doc value on nested type in script query (filter context)

Hi Guys,

I have the below index:

cargroup

 "mappings": {
    "properties": {
      "id":     { "type": "integer" },
      "cars":   { "type": "nested",
                            "properties": {
                                    "brand": {
                                        "type": "keyword"
                                    },
                                    "value": {
                                        "type": "integer"
                                    }
                                }
                        },

How can I access cars properties using docs value in script query?

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-script-query.html

After reading through the docs, I found out that script query is executed in filter context, which means that only docs and params are available.

https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-filter-context.html

Is there any way I can alter the mapping so that nested type can be accessed through doc value?

This is the problem I am trying to solve:

So far I haven't been able to found any other solution besides using script query. Any suggestions is welcome.

Thank you

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