# How to change index behavior

**URL:** <https://discuss.elastic.co/t/how-to-change-index-behavior/4716>\
**Category:** Elasticsearch\
**Created:** [June 27, 2011, 4:21pm UTC](https://discuss.elastic.co/t/how-to-change-index-behavior/4716 "2011-06-27T16:21:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexey\_N\_Zlobin](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Alexey\_N\_Zlobin](https://discuss.elastic.co/u/Alexey_N_Zlobin)\
**Post date:** [June 27, 2011, 4:21pm UTC](https://discuss.elastic.co/t/how-to-change-index-behavior/4716/1 "2011-06-27T16:21:58Z")

</div>

Hi,

I need to do exact string search on one of field in my documents  
(preface you can see in my SO question [1]). So I probably need to  
change index mapping for this field from the default to something what  
doesn't try to process input string. But here I stuck.

I probably need to change analyzer type, used for particular field  
with Put Mapping API [2], but I just can't find the right way to do  
that. I fount an example, where the "not\_analyzed" index was used for  
a field ([3], the second snippet), but it's unclear was it created or  
it is a default option?

Furthermore, Get Settings method [4] just fails for my index with the  
message: "No handler found for uri [/records/\_settings/] and method  
[GET]". So I can't inspect current configuration state.

I'll appreciate any tips about how I can solve this issues.

[1] [http://stackoverflow.com/questions/6465852/how-to-search-by-array-elements-in-elasticsearch](http://stackoverflow.com/questions/6465852/how-to-search-by-array-elements-in-elasticsearch)  
[2] [http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html](http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html)  
[3] [http://www.elasticsearch.org/guide/reference/mapping/core-types.html](http://www.elasticsearch.org/guide/reference/mapping/core-types.html)  
[4] [http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings.html](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings.html)

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [June 27, 2011, 6:18pm UTC](https://discuss.elastic.co/t/how-to-change-index-behavior/4716/2 "2011-06-27T18:18:48Z")

</div>

Hi Alexey

> I need to do exact string search on one of field in my documents  
> (preface you can see in my SO question [1]). So I probably need to  
> change index mapping for this field from the default to something what  
> doesn't try to process input string. But here I stuck.
> 
> I probably need to change analyzer type, used for particular field  
> with Put Mapping API [2], but I just can't find the right way to do  
> that. I fount an example, where the "not\_analyzed" index was used for  
> a field ([3], the second snippet), but it's unclear was it created or  
> it is a default option?

If you want a string field to not be analyzed, then you need to specify  
it manually. You can do this when you create the index, or you can put  
the mapping later, but you can't change the mapping for a field once it  
already exists (eg after you have indexed data that includes that  
field).

Here is an example of how to do it when creating an index:

curl -XPUT '[http://127.0.0.1:9200/foo/?pretty=1](http://127.0.0.1:9200/foo/?pretty=1)' -d '  
{  
"mappings" : {  
"my\_type" : {  
"properties" : {  
"myfield" : {  
"index" : "not\_analyzed",  
"type" : "string"  
}  
}  
}  
}  
}  
'

> Furthermore, Get Settings method [4] just fails for my index with the  
> message: "No handler found for uri [/records/\_settings/] and method  
> [GET]". So I can't inspect current configuration state.

What version of ES are you using?

The call should look like this:

curl -XGET '[http://127.0.0.1:9200/records/\_settings?pretty=1](http://127.0.0.1:9200/records/_settings?pretty=1)'

clint

---

<div class="post-metadata">

**Author:** ![Alexey\_N\_Zlobin](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Alexey\_N\_Zlobin](https://discuss.elastic.co/u/Alexey_N_Zlobin)\
**Post date:** [June 28, 2011, 7:32am UTC](https://discuss.elastic.co/t/how-to-change-index-behavior/4716/3 "2011-06-28T07:32:43Z")

</div>

Thank you, this mapping works exactly as expected!

My ES version is 0.15.2. The call "curl -XGET  
'[http://127.0.0.1:9200/records/\_settings?pretty=1](http://127.0.0.1:9200/records/_settings?pretty=1)'" returns this  
response:  
"No handler found for uri [/records/\_settings?pretty=1] and method [GET]"

On Mon, Jun 27, 2011 at 10:18 PM, Clinton Gormley  
[clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk) wrote:

> Hi Alexey
> 
> > I need to do exact string search on one of field in my documents  
> > (preface you can see in my SO question [1]). So I probably need to  
> > change index mapping for this field from the default to something what  
> > doesn't try to process input string. But here I stuck.
> > 
> > I probably need to change analyzer type, used for particular field  
> > with Put Mapping API [2], but I just can't find the right way to do  
> > that. I fount an example, where the "not\_analyzed" index was used for  
> > a field ([3], the second snippet), but it's unclear was it created or  
> > it is a default option?
> 
> If you want a string field to not be analyzed, then you need to specify  
> it manually. You can do this when you create the index, or you can put  
> the mapping later, but you can't change the mapping for a field once it  
> already exists (eg after you have indexed data that includes that  
> field).
> 
> Here is an example of how to do it when creating an index:
> 
> curl -XPUT '[http://127.0.0.1:9200/foo/?pretty=1](http://127.0.0.1:9200/foo/?pretty=1)' -d '  
> {  
> "mappings" : {  
> "my\_type" : {  
> "properties" : {  
> "myfield" : {  
> "index" : "not\_analyzed",  
> "type" : "string"  
> }  
> }  
> }  
> }  
> }  
> '
> 
> > Furthermore, Get Settings method [4] just fails for my index with the  
> > message: "No handler found for uri [/records/\_settings/] and method  
> > [GET]". So I can't inspect current configuration state.
> 
> What version of ES are you using?
> 
> The call should look like this:
> 
> curl -XGET '[http://127.0.0.1:9200/records/\_settings?pretty=1](http://127.0.0.1:9200/records/_settings?pretty=1)'
> 
> clint

--  
Best regards,  
Alexey Zlobin.

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [June 28, 2011, 10:15am UTC](https://discuss.elastic.co/t/how-to-change-index-behavior/4716/4 "2011-06-28T10:15:21Z")

</div>

On Tue, 2011-06-28 at 11:32 +0400, Alexey Zlobin wrote:

> Thank you, this mapping works exactly as expected!
> 
> My ES version is 0.15.2. The call "curl -XGET  
> '[http://127.0.0.1:9200/records/\_settings?pretty=1](http://127.0.0.1:9200/records/_settings?pretty=1)'" returns this  
> response:  
> "No handler found for uri [/records/\_settings?pretty=1] and method [GET]"

This was only added in version 0.16

clint

---

<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:02am UTC](https://discuss.elastic.co/t/how-to-change-index-behavior/4716/5 "2017-07-06T04:02:24Z")

</div>


