# Script Filters referencing a field with special characters

**URL:** <https://discuss.elastic.co/t/script-filters-referencing-a-field-with-special-characters/7090>\
**Category:** Elasticsearch\
**Created:** [March 22, 2012, 1:52am UTC](https://discuss.elastic.co/t/script-filters-referencing-a-field-with-special-characters/7090 "2012-03-22T01:52:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![posejavier](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@posejavier](https://discuss.elastic.co/u/posejavier)\
**Post date:** [March 22, 2012, 1:52am UTC](https://discuss.elastic.co/t/script-filters-referencing-a-field-with-special-characters/7090/1 "2012-03-22T01:52:09Z")

</div>

Hi all,  
I have a Script Filters defined in the couchdb river.  
In this script I need to refer to a field of the documents which has special characters on it, e.g. '-'  
So the field would be, for example: 'number-of-houses'

How can I refer to this field from the Script Filter ??

In a normal javascript in a view I would use doc['number-of-houses'], but in the Script Filters I don't know...  
I tried:

ctx.doc['number-of-houses']  
ctx.doc.'number-of-houses'  
ctx[doc]['number-of-houses']  
...

...but none of these options works.

---

<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 6, 2017, 3:35am UTC](https://discuss.elastic.co/t/script-filters-referencing-a-field-with-special-characters/7090/2 "2017-07-06T03:35:15Z")

</div>

Closed on July 6, 2017, 3:35am UTC


