# Field names with dot notation in ES Node.js client

**URL:** <https://discuss.elastic.co/t/field-names-with-dot-notation-in-es-node-js-client/277147>\
**Category:** Elasticsearch\
**Created:** [June 27, 2021, 12:33pm UTC](https://discuss.elastic.co/t/field-names-with-dot-notation-in-es-node-js-client/277147 "2021-06-27T12:33:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cholley\_Alexandre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cholley_alexandre/32/90867_2.png) [@Cholley\_Alexandre](https://discuss.elastic.co/u/Cholley_Alexandre)\
**Post date:** [June 27, 2021, 12:33pm UTC](https://discuss.elastic.co/t/field-names-with-dot-notation-in-es-node-js-client/277147/1 "2021-06-27T12:33:00Z")

</div>

Hi, I'm trying to write a field with dot notation in the body of the Search API in Node.js Client but it doesn't work.

The mapping is :

```auto
"my_field": {
    "type":"text",
    "fields": {
      "keyword": {
        "type": "keyword"
      } 
    }
  }

```

I tried :

```auto
query: {
    bool: {
      must: {
        term: my_field.keyword: my_value
      }
    }
}

```

```auto
query: {
    bool: {
      must: {
        term: "my_field.keyword": my_value
      }
    }
}

```

```auto
query: {
    bool: {
      must: {
        term: {
          my_field: {
            keyword: my_value
          }
        }
      }
    }
}

```

```auto
query: {
    bool: {
      must: {
        term: {
          my_field: {
              fields: {
                  keyword: my_value
              }
          }
        }
      }
    }
}

```

It's throws a parsing error from Elasticsearch.

Thank you in advance for your help 🙂

---

<div class="post-metadata">

**Author:** ![Cholley\_Alexandre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cholley_alexandre/32/90867_2.png) [@Cholley\_Alexandre](https://discuss.elastic.co/u/Cholley_Alexandre)\
**Post date:** [June 27, 2021, 4:41pm UTC](https://discuss.elastic.co/t/field-names-with-dot-notation-in-es-node-js-client/277147/2 "2021-06-27T16:41:11Z")

</div>

After several tests on Node.js client, it works using JSON Object Notation for entirely body (all field names and values double quoted) instead of a common object notation. In the documentation it's mentioned :

[body : `object` - The search definition using the Query DSL](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#_search)

and the example show a common object notation but not a JSON Object notation in the body field. I suppose that works because the requests need to be send to elasticsearch with application/json content-type and the parser work to do that.

```auto
"query": {
    "bool": {
      "must": {
        "term": "my_field.keyword": "my_value"
      }
    }
}

```

Could someone confirm that it's a correct way please ?

Thank you in advance.

---

<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 25, 2021, 4:42pm UTC](https://discuss.elastic.co/t/field-names-with-dot-notation-in-es-node-js-client/277147/3 "2021-07-25T16:42:04Z")

</div>

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