# Problem in search when use "index: not\_analyzed"

**URL:** <https://discuss.elastic.co/t/problem-in-search-when-use-index-not-analyzed/9536>\
**Category:** Elasticsearch\
**Created:** [November 2, 2012, 7:33pm UTC](https://discuss.elastic.co/t/problem-in-search-when-use-index-not-analyzed/9536 "2012-11-02T19:33:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fernando\_Garrido](https://avatars.discourse-cdn.com/v4/letter/f/ea5d25/32.png) [@Fernando\_Garrido](https://discuss.elastic.co/u/Fernando_Garrido)\
**Post date:** [November 2, 2012, 7:33pm UTC](https://discuss.elastic.co/t/problem-in-search-when-use-index-not-analyzed/9536/1 "2012-11-02T19:33:16Z")

</div>

Hello, i have a problem if i search for a field mapping it as "index:  
not\_analyed"

This is my script that create the index:

curl -XPUT '[http://localhost:9200/contenidos](http://localhost:9200/contenidos)' -d '{  
"mappings": {  
"categoria": {  
"\_all": { "enabled": false },  
"\_source": { "compressed": true },  
"properties": {  
"name": { "type": "string", "index": "analyzed" },  
"alpha": { "type": "string", "index": "not\_analyzed" }  
}  
}  
}  
}'

Here the script that insert data:

curl -XPUT '[http://localhost:9200/contenidos/categoria/3371](http://localhost:9200/contenidos/categoria/3371)' -d '{ "name":  
"Circo del Sol", "parentId": "123" }'  
curl -XPUT '[http://localhost:9200/contenidos/categoria/13571](http://localhost:9200/contenidos/categoria/13571)' -d '{ "name":  
"Circo del Sol Pepito", "parentId": "123" }'  
curl -XPUT '[http://localhost:9200/contenidos/categoria/21855](http://localhost:9200/contenidos/categoria/21855)' -d '{ "name":  
"Circo del Sol Zaragoza", "parentId": "122" }'  
curl -XPUT '[http://localhost:9200/contenidos/categoria/3750](http://localhost:9200/contenidos/categoria/3750)' -d '{ "name":  
"Circo del Sol - Corteo", "parentId": "125" }'

If i search for field "name" wthis this query all results have de same  
score:

{  
"explain": false,  
"size": "10",  
"query": {  
"match": {  
"name": "circo del sol"  
}  
}  
}

But if i do the same search, but with the field "alpha", i get not results,  
the query is:

{  
"explain": false,  
"size": "10",  
"query": {  
"match": {  
"alpha": "circo del sol"  
}  
}  
}

Please, if anyone has any idea how i do the search will be very gratefull.  
Thanks!!

--

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 6, 2012, 1:01pm UTC](https://discuss.elastic.co/t/problem-in-search-when-use-index-not-analyzed/9536/2 "2012-11-06T13:01:57Z")

</div>

Did you index something with content in alpha field?  
Your curl recreation does not show it.

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 2 nov. 2012 à 20:33, Fernando Garrido [fernando.garrido@soluciones3f.com.ar](mailto:fernando.garrido@soluciones3f.com.ar) a écrit :

> Hello, i have a problem if i search for a field mapping it as "index: not\_analyed"
> 
> This is my script that create the index:
> 
> curl -XPUT '[http://localhost:9200/contenidos](http://localhost:9200/contenidos)' -d '{  
> "mappings": {  
> "categoria": {  
> "\_all": { "enabled": false },  
> "\_source": { "compressed": true },  
> "properties": {  
> "name": { "type": "string", "index": "analyzed" },  
> "alpha": { "type": "string", "index": "not\_analyzed" }  
> }  
> }  
> }  
> }'
> 
> Here the script that insert data:
> 
> curl -XPUT '[http://localhost:9200/contenidos/categoria/3371](http://localhost:9200/contenidos/categoria/3371)' -d '{ "name": "Circo del Sol", "parentId": "123" }'  
> curl -XPUT '[http://localhost:9200/contenidos/categoria/13571](http://localhost:9200/contenidos/categoria/13571)' -d '{ "name": "Circo del Sol Pepito", "parentId": "123" }'  
> curl -XPUT '[http://localhost:9200/contenidos/categoria/21855](http://localhost:9200/contenidos/categoria/21855)' -d '{ "name": "Circo del Sol Zaragoza", "parentId": "122" }'  
> curl -XPUT '[http://localhost:9200/contenidos/categoria/3750](http://localhost:9200/contenidos/categoria/3750)' -d '{ "name": "Circo del Sol - Corteo", "parentId": "125" }'
> 
> If i search for field "name" wthis this query all results have de same score:
> 
> {  
> "explain": false,  
> "size": "10",  
> "query": {  
> "match": {  
> "name": "circo del sol"  
> }  
> }  
> }
> 
> But if i do the same search, but with the field "alpha", i get not results, the query is:
> 
> {  
> "explain": false,  
> "size": "10",  
> "query": {  
> "match": {  
> "alpha": "circo del sol"  
> }  
> }  
> }
> 
> ## Please, if anyone has any idea how i do the search will be very gratefull. 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, 3:05am UTC](https://discuss.elastic.co/t/problem-in-search-when-use-index-not-analyzed/9536/3 "2017-07-06T03:05:58Z")

</div>


