# Field access in filter script

**URL:** <https://discuss.elastic.co/t/field-access-in-filter-script/242354>\
**Category:** Elasticsearch\
**Created:** [July 23, 2020, 2:22pm UTC](https://discuss.elastic.co/t/field-access-in-filter-script/242354 "2020-07-23T14:22:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tudro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tudro/32/41735_2.png) [@tudro](https://discuss.elastic.co/u/tudro)\
**Post date:** [July 23, 2020, 2:22pm UTC](https://discuss.elastic.co/t/field-access-in-filter-script/242354/1 "2020-07-23T14:22:22Z")

</div>

Hello,

I have a mapping like this  
`"user": { "mappings": { "properties": { "profile": { "properties": { "cars": {...} }}}}} `  
I am trying to access the `profile.cars` from a filter script with `doc["profile.cars"]` and i get `No field found for [profile.cars] in mapping with types []`

`Cars` is an array and i want to get the length.

I have no problem accessing it from a `script_score` with `params._source.profile.cars`.

Or maybe i'm doing it wrong. My objective is to filter out any documents that don't have a certain model of car in the `profile.cars` array.

Using ES7.6.2

Thank you

---

<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:** [August 20, 2020, 2:22pm UTC](https://discuss.elastic.co/t/field-access-in-filter-script/242354/2 "2020-08-20T14:22:28Z")

</div>

Closed on August 20, 2020, 2:22pm UTC

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