# Update ES mapping from Groovy/Gradle script

**URL:** https://discuss.elastic.co/t/update-es-mapping-from-groovy-gradle-script/18646
**Category:** Elasticsearch
**Created:** [July 14, 2014, 11:17am UTC](https://discuss.elastic.co/t/update-es-mapping-from-groovy-gradle-script/18646 "2014-07-14T11:17:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Serhan\_Shbeita](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@Serhan\_Shbeita](https://discuss.elastic.co/u/Serhan_Shbeita)
#### Post date: [July 14, 2014, 11:17am UTC](https://discuss.elastic.co/t/update-es-mapping-from-groovy-gradle-script/18646/1 "2014-07-14T11:17:40Z")

</div>

Hi  
I'm trying to update mapping of one field to be _not\_analyzed_  
First I send POST to create the river and the index:

> ```
> println "starting the river"
> http.request(POST, JSON) { req ->
> uri.path = "_river/ffxi/_meta"
> body = [
> type: "mongodb",
> mongodb: [
> servers: [
> [
> host: "127.0.0.1",
> port: Integer.valueOf(mongoPort).
> 
> ```
> 
> intValue()  
> ]  
> ],  
> options: [  
> secondary\_read\_reference: true,  
> exclude\_fields: ["coursesOfActions"]  
> ],  
> db: "tx",  
> collection: "indicators"  
> ],  
> index: [  
> name: "indicators",  
> type: "indicator"  
> ]  
> ]  
> response.success = { resp, json -\>  
> println "Create index response status: ${resp.statusLine}"  
> }  
> }
> 
> Then I try to send update mapping to update a field to be _not\_analyzed_ :

```
 http.request(PUT, JSON) { req ->
    uri.path = "indicators/indicator/%5mappings"

    body = [
            indicator: [
                    observable: [
                            value: [
                                    type: "string",
                                    index: "not_analyzed"
                            ]
                    ]
            ]
    ]

    response.success = { resp, json ->
        println "Update mappings response status: ${resp.statusLine}"
    }

```

The problem when doing this i tried to get the mappings of the indicators  
index: _[http://localhost:9200/indicators/indicator/\_mapping](http://localhost:9200/indicators/indicator/_mapping)_  
and this what i get:

{  
"indicators": {  
"mappings": {  
"indicator": {  
"properties": {  
"indicator": {  
"properties": {  
"observable": {  
"properties": {  
"value": {  
"properties": {  
"index": {  
"type": "string"  
},  
"type": {  
"type": "string"  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}

Any idea? properties element added to all elements!!!  
WHY!?

Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/14350df7-0f00-42f9-8bff-19d508e6be14%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/14350df7-0f00-42f9-8bff-19d508e6be14%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:16am UTC](https://discuss.elastic.co/t/update-es-mapping-from-groovy-gradle-script/18646/2 "2017-07-06T01:16:08Z")

</div>


