Thanks David Pilato. However, as I mentioned, I could see the correct mappings for the correct index and type like below.
curl -XGET http://{my_ip_address}:9200/my_index/my_type/_mapping/ {"my_type":{"properties":{........ "myFieldExact":{"type":"string","index": "not_analyzed","omit_norms":true,"index_options":"docs"},...... }}} After I index a new document into the index I got the changed mapping result for the exactly same GET url. curl -XGET http://{my_ip_address}:9200/my_index/my_type/_mapping/ {"my_type":{"properties":{........ "myFieldExact":{"type":"string"},...... }}} On Sunday, April 27, 2014 5:52:03 PM UTC+9, David Pilato wrote: > > Probably your first mapping is incorrect or applied to another type or > index. > > -- > David ;-) > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs > > Le 27 avr. 2014 à 09:45, Ho-sang Jeon <[email protected] <javascript:>> a > écrit : > > I'm in trouble with the overwriting action of prepareIndex method in > Elasticsearch Java API. > > The problem is that my *mapping definition has changed after new document > has indexed.* > > First of all, I defined an mapping to set "not_analyzed" index for a > particular field. > > String json = myMethodToGetMapping(); > PutMappingResponse pmrs = client.admin().indices().preparePutMapping( > "my_index").setType("my_type").setSource(json).setIgnoreConflicts(true). > execute().actionGet(); > > > if (pmrs == null || !pmrs.isAcknowledged()) { > System.out.println("Put Mapping Failure."); > } else { > System.out.println("Put Mapping Success."); > } > > In my mapping string(json), there is a field has settings like below. > > "myFieldExact":{ > "type":"string", > "index": "not_analyzed", > "dynamic": false > } > > After the code has executed, I could see the proper mapping which I want > to get. > > curl -XGET http://{my_ip_address}:9200/my_index/my_type/_mapping/ > > > {"my_type":{"properties":{........ "myFieldExact":{"type":"string","index" > :"not_analyzed","omit_norms":true,"index_options":"docs"},...... }}} > > *HOWEVER*, this mapping has been changed after I put some data using Java > API prepareIndex. > > MyObject myObject = new MyObject(); > myObject.setMyFieldExact("some-value"); > String json = new org.codehaus.jackson.map.ObjectMapper(). > writeValueAsString(myObject); > client.prepareIndex("my_index", "my_type", "my_id") > .setSource(json).execute().actionGet(); > > The document successfully indexed into "my_index/my_type/my_id". > > Here is the problem I have. > > After the new record has been indexed, the original mapping definition has > changed like below. > > curl -XGET http://{my_ip_address}:9200/my_index/my_type/_mapping/ > > > {"my_type":{"properties":{........ "myFieldExact":{"type":"string"},...... > }}} > > > In short, the *"index":"not_analyzed" property has been gone after the > new document has indexed.* > > Is there anyone can help me? > > Thank you very much in advance. > > -- > 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 [email protected] <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/5ee40a83-272b-4843-ba6f-f79b78737942%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/5ee40a83-272b-4843-ba6f-f79b78737942%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/caf69fb3-2d65-4cf4-9f4c-ca88c959906a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
