# Mapping to add multi\_fileds

**URL:** <https://discuss.elastic.co/t/mapping-to-add-multi-fileds/183734>\
**Category:** Elasticsearch\
**Created:** [May 31, 2019, 1:50pm UTC](https://discuss.elastic.co/t/mapping-to-add-multi-fileds/183734 "2019-05-31T13:50:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nlod0001](https://avatars.discourse-cdn.com/v4/letter/n/59ef9b/32.png) [@nlod0001](https://discuss.elastic.co/u/nlod0001)\
**Post date:** [May 31, 2019, 1:50pm UTC](https://discuss.elastic.co/t/mapping-to-add-multi-fileds/183734/1 "2019-05-31T13:50:31Z")

</div>

I have an index (whitelist) so defined

> ```
> {
> "mapping": {
> "_doc": {
> "properties": {
> "@timestamp": {
> "type": "date"
> },
> "network": {
> "type": "ip_range"
> }
> }
> }
> }
> }
> 
> ```

I need to update network field to support multi\_fileds, i.e. I need that this index changes in:

> ```
> {
> "mapping": {
> "_doc": {
> "properties": {
> "@timestamp": {
> "type": "date"
> },
> "network": {
> "type": "ip_range"
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> }
> }
> }
> }
> }
> }
> }
> 
> ```

How can I use \_mapping api to do this?  
I tried unsuccessfully with command like this one (and different variants), but all return errors.

> ```
> curl -X PUT "<machine>:9200/whitelist/_mapping" -H 'Content-Type: application/json' -d '
> {      
> "properties": {
> "network":{"type":"ip_range","ignore_above":256}
> }
> }	
> }
> '
> 
> ```

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [June 2, 2019, 8:12pm UTC](https://discuss.elastic.co/t/mapping-to-add-multi-fileds/183734/2 "2019-06-02T20:12:52Z")

</div>

Something like this should work:

```auto
curl -XPUT "http://localhost:9200/whitelist/_mapping/_doc" -H 'Content-Type: application/json' -d'
{
  "properties": {
    "network": {
      "type": "ip_range",
      "fields": {
        "keyword": {
          "type": "keyword",
          "ignore_above": 256
        }
      }
    }
  }
}'

```

---

<div class="post-metadata">

**Author:** ![nlod0001](https://avatars.discourse-cdn.com/v4/letter/n/59ef9b/32.png) [@nlod0001](https://discuss.elastic.co/u/nlod0001)\
**Post date:** [June 3, 2019, 8:57am UTC](https://discuss.elastic.co/t/mapping-to-add-multi-fileds/183734/3 "2019-06-03T08:57:14Z")

</div>

Thanks so much Abdon.  
It 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 1, 2019, 8:57am UTC](https://discuss.elastic.co/t/mapping-to-add-multi-fileds/183734/4 "2019-07-01T08:57:26Z")

</div>

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