# Field name \[hello.world\] cannot contain '.' error, when registering query with Percolate on ES 2.2.2

**URL:** <https://discuss.elastic.co/t/field-name-hello-world-cannot-contain-error-when-registering-query-with-percolate-on-es-2-2-2/50327>\
**Category:** Elasticsearch\
**Created:** [May 18, 2016, 10:02am UTC](https://discuss.elastic.co/t/field-name-hello-world-cannot-contain-error-when-registering-query-with-percolate-on-es-2-2-2/50327 "2016-05-18T10:02:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahilc2200](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sahilc2200/32/3669_2.png) [@sahilc2200](https://discuss.elastic.co/u/sahilc2200)\
**Post date:** [May 18, 2016, 10:02am UTC](https://discuss.elastic.co/t/field-name-hello-world-cannot-contain-error-when-registering-query-with-percolate-on-es-2-2-2/50327/1 "2016-05-18T10:02:51Z")

</div>

Hi,

I am trying to save a query in the Elasticsearch percolator, but it throws this error "Field name [hello.world] cannot contain '.'".

The mapping is:  
{  
"hello": {  
"properties":{  
"world":{  
"type":"string"  
}  
}  
}  
}

The query I am trying to save is  
{  
"query":{  
"terms":{  
"hello.world":["me"]  
}  
}  
}

Can someone please help me?

---

<div class="post-metadata">

**Author:** ![geekpete](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/geekpete/32/20409_2.png) [@geekpete](https://discuss.elastic.co/u/geekpete)\
**Post date:** [May 20, 2016, 6:40am UTC](https://discuss.elastic.co/t/field-name-hello-world-cannot-contain-error-when-registering-query-with-percolate-on-es-2-2-2/50327/2 "2016-05-20T06:40:54Z")

</div>

Hi Sahil,

Dots in field names was disallowed in elasticsearch version 2.0, so unfortunately this will probably require you to change your field name to something without dots like an underscore or to use a nested field mapping instead.

See here for the change detail in 2.0: [https://www.elastic.co/guide/en/elasticsearch/reference/2.0/breaking\_20\_mapping\_changes.html#\_field\_names\_may\_not\_contain\_dots](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/breaking_20_mapping_changes.html#_field_names_may_not_contain_dots)

* * *

If you're using logstash there's a de\_dot filter to help out converting dots to either underscores or nested fields, elaborated on in this blog post:

> **[Introducing the de\_dot filter
	  	 | Elastic](https://www.elastic.co/blog/introducing-the-de_dot-filter)**
>
> Hello, fellow Logstashers! We’ve been pleased with the community response to our recent 2.0 release.  As this was a major release, there were some breaking changes, especially in conjunction with...

With this filter, you can probably use logstash to reindex your data in 1.x cluster to a mapping without dots in field names before upgrading to 2.x

---

<div class="post-metadata">

**Author:** ![ave19](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ave19/32/11631_2.png) [@ave19](https://discuss.elastic.co/u/ave19)\
**Post date:** [June 24, 2016, 4:56pm UTC](https://discuss.elastic.co/t/field-name-hello-world-cannot-contain-error-when-registering-query-with-percolate-on-es-2-2-2/50327/3 "2016-06-24T16:56:25Z")

</div>

Hey! I just ran into this, too. Same kind of sub-field situation.

I understand that dots were disallowed because they could be confused with fields. But this _is_ a field, right? "world" is a field of "hello", so the dot syntax should make sense to Elasticsearch?

**tldr:** change _terms_ to _term_

I tried this query:

```auto
{
  "query": {
    "term": {
      "hello.world": "foo"
    }
  }
}

```

and it worked,

```auto
{
  "took": 8,
  "timed_out": false,
  "_shards": {
    "total": 4,
    "successful": 4,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 0.30685282,
    "hits": [
      {
        "_index": "ave_perc_test",
        "_type": "apt_type_1",
        "_id": "1",
        "_score": 0.30685282,
        "_source": {
          "hello": {
            "world": "foo"
          }
        }
      }
    ]
  }
}

```

So then I tried that as a percolator:

```auto
curl -XPUT 'https://host/ave_perc_test/.percolator/1' -d '{
  "query": {
    "term": {
      "hello.world": "foo"
    }
  }
}'

```

and got

```auto
{
  "_index": "ave_perc_test",
  "_type": ".percolator",
  "_id": "1",
  "_version": 1,
  "_shards": {
    "total": 3,
    "successful": 3,
    "failed": 0
  },
  "created": true
}

```

Awesome! Then I percolated the doc and got:

```auto
{
  "took": 52,
  "_shards": {
    "total": 4,
    "successful": 4,
    "failed": 0
  },
  "total": 1,
  "matches": [
    {
      "_index": "ave_perc_test",
      "_id": "1"
    }
  ]
}

```

So, there ya go. Just use **term** if you have a subfield?

-ave

---

<div class="post-metadata">

**Author:** ![jasl](https://avatars.discourse-cdn.com/v4/letter/j/9fc348/32.png) [@jasl](https://discuss.elastic.co/u/jasl)\
**Post date:** [July 28, 2016, 8:33pm UTC](https://discuss.elastic.co/t/field-name-hello-world-cannot-contain-error-when-registering-query-with-percolate-on-es-2-2-2/50327/4 "2016-07-28T20:33:51Z")

</div>

I have the same issue, in my case I am trying to acces a subfield (.raw) previously mapped:

```
{
   "query":{
      "query_string":{
         "query":"\"foo\"",
         "default_operator":"AND"
      }
   },
   "filter":{
      "bool":{
         "must":[
            {
               "range":{
                  "date":{
                     "lt":"2016-04-30",
                     "gte":"1950-01-01"
                  }
               }
            },
            {
               "term":{
                  "state.raw":"foo"
               }
            }
         ],
         "should":{ }
      }
   }
}

```

And I get the same error as @sahilc2200

relevant mapping:

```
"state": {
        "type": "string",
        "fields": {
          "state": {
            "type": "string"
          },
          "raw": {
            "type": "string",
            "index": "not_analyzed"
          }
        }
      },
```

---

<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, 10:31pm UTC](https://discuss.elastic.co/t/field-name-hello-world-cannot-contain-error-when-registering-query-with-percolate-on-es-2-2-2/50327/5 "2017-07-05T22:31:58Z")

</div>


