# Minus sign in field name doesn't work in nested filter

**URL:** <https://discuss.elastic.co/t/minus-sign-in-field-name-doesnt-work-in-nested-filter/31762>\
**Category:** Elasticsearch\
**Created:** [October 7, 2015, 10:42am UTC](https://discuss.elastic.co/t/minus-sign-in-field-name-doesnt-work-in-nested-filter/31762 "2015-10-07T10:42:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Petr\_Yanovich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/petr_yanovich/32/2007_2.png) [@Petr\_Yanovich](https://discuss.elastic.co/u/Petr_Yanovich)\
**Post date:** [October 7, 2015, 10:42am UTC](https://discuss.elastic.co/t/minus-sign-in-field-name-doesnt-work-in-nested-filter/31762/1 "2015-10-07T10:42:15Z")

</div>

Imagine I have got a mapping

```json
{
  "first-name": {
    "type": "string"
  },
  "profiles": {
    "type": "nested",
    "properties": {
      "first-name": {
        "type": "string"
      },
      "email": {
        "type": "string"
       }
    }
  }
}

```

And a query:

```json
{
  "query": {
    "filtered": {
      "filter": {
        "nested": {
          "path": "profiles",
          "filter": {
            "term": {
              "first-name": "Nick"
            }
          }
        }
      }
    }
  }
}

```

This query doesn't work. It works for email field, but not for "first-name".  
Also querying root "first-name" field works fine, the problem happens only while I am trying to use nested filter.

Thank you.

---

<div class="post-metadata">

**Author:** ![Petr\_Yanovich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/petr_yanovich/32/2007_2.png) [@Petr\_Yanovich](https://discuss.elastic.co/u/Petr_Yanovich)\
**Post date:** [October 7, 2015, 3:32pm UTC](https://discuss.elastic.co/t/minus-sign-in-field-name-doesnt-work-in-nested-filter/31762/2 "2015-10-07T15:32:03Z")

</div>

Ok. The problem was not related to minus sign. I should use full qualified names in nested filter

```json
{
  "query": {
    "filtered": {
      "filter": {
        "nested": {
          "path": "profiles",
          "filter": {
            "term": {
              "profiles.first-name": "Nick"
            }
          }
        }
      }
    }
  }
}

```

---

<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 5, 2017, 11:46pm UTC](https://discuss.elastic.co/t/minus-sign-in-field-name-doesnt-work-in-nested-filter/31762/3 "2017-07-05T23:46:07Z")

</div>


