# Manipulate Mapping from Java

**URL:** <https://discuss.elastic.co/t/manipulate-mapping-from-java/4128>\
**Category:** Elasticsearch\
**Created:** [March 18, 2011, 6:43pm UTC](https://discuss.elastic.co/t/manipulate-mapping-from-java/4128 "2011-03-18T18:43:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ildella](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ildella/32/3219_2.png) [@ildella](https://discuss.elastic.co/u/ildella)\
**Post date:** [March 18, 2011, 6:43pm UTC](https://discuss.elastic.co/t/manipulate-mapping-from-java/4128/1 "2011-03-18T18:43:10Z")

</div>

Hi. I just started using ES and I need to create a simple interface to  
manage indexes on different product I am developing using the same  
backend that deal with ES.

I'm having this problem understanding how to pass the json code I find  
in the doc to Java API to generate the request, like:

IndicesAdminClient indices = client.admin().indices();  
String snowball = "{analysis: { analyzer: { default: { type:  
snowball }}}}";  
PutMappingRequest source =  
Requests.putMappingRequest("artworks").source(snowball);  
PutMappingResponse actionGet =  
indices.putMapping(source).actionGet();

is not working cause the snowball String is incorrect. I've really no  
idea how that String is supposed to be formatted and  
I've watched here:  
[http://www.elasticsearch.org/guide/reference/index-modules/analysis/](http://www.elasticsearch.org/guide/reference/index-modules/analysis/)

but I can't find a prooper doc for my problem.

I am also a little confused about how to tell ES to index my fields.  
Let's suppose that in the "artworks" index I have "artwork" document  
type. With that command, given a proper String as source, I Can expect  
all the field of artwork document type to be analysed with the  
snowball filter?

Thanks.

---

<div class="post-metadata">

**Author:** ![K\_B](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@K\_B](https://discuss.elastic.co/u/K_B)\
**Post date:** [March 18, 2011, 7:29pm UTC](https://discuss.elastic.co/t/manipulate-mapping-from-java/4128/2 "2011-03-18T19:29:37Z")

</div>

you need to pass the " with the config strings, e.g:

type: snowball -\> type: "snowball"

Best

On 18 Mrz., 19:43, della [ilde...@gmail.com](mailto:ilde...@gmail.com) wrote:

> Hi. I just started using ES and I need to create a simple interface to  
> manage indexes on different product I am developing using the same  
> backend that deal with ES.
> 
> I'm having this problem understanding how to pass the json code I find  
> in the doc to Java API to generate the request, like:
> 
> IndicesAdminClient indices = client.admin().indices();  
> String snowball = "{analysis: { analyzer: { default: { type:  
> snowball }}}}";  
> PutMappingRequest source =  
> Requests.putMappingRequest("artworks").source(snowball);  
> PutMappingResponse actionGet =  
> indices.putMapping(source).actionGet();
> 
> is not working cause the snowball String is incorrect. I've really no  
> idea how that String is supposed to be formatted and  
> I've watched here:[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/analysis/)
> 
> but I can't find a prooper doc for my problem.
> 
> I am also a little confused about how to tell ES to index my fields.  
> Let's suppose that in the "artworks" index I have "artwork" document  
> type. With that command, given a proper String as source, I Can expect  
> all the field of artwork document type to be analysed with the  
> snowball filter?
> 
> Thanks.

---

<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, 4:09am UTC](https://discuss.elastic.co/t/manipulate-mapping-from-java/4128/3 "2017-07-06T04:09:37Z")

</div>


