# Problem with zipcode

**URL:** <https://discuss.elastic.co/t/problem-with-zipcode/19880>\
**Category:** Elasticsearch\
**Created:** [September 19, 2014, 8:44am UTC](https://discuss.elastic.co/t/problem-with-zipcode/19880 "2014-09-19T08:44:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hari\_Rajaonarifetra](https://avatars.discourse-cdn.com/v4/letter/h/ee7513/32.png) [@Hari\_Rajaonarifetra](https://discuss.elastic.co/u/Hari_Rajaonarifetra)\
**Post date:** [September 19, 2014, 8:44am UTC](https://discuss.elastic.co/t/problem-with-zipcode/19880/1 "2014-09-19T08:44:26Z")

</div>

Hi,

I have a big problem with zipcode.

See below my config :

ville:  
mappings:  
ville\_nom:  
index\_analyzer : cities\_index\_analyzer  
search\_analyzer : cities\_search\_analyzer  
type : string  
ville\_cp:  
type: string  
index: not\_analyzed

But when I run "populate", elasticsearch cut the 0 on the begining of  
ville\_cp (03000 =\> 3000).

Someone can help me?

Thanks,  
Hari

--  
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/0348b69f-5418-4c9d-9f9e-e3ce2425a0fb%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0348b69f-5418-4c9d-9f9e-e3ce2425a0fb%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [September 19, 2014, 9:16am UTC](https://discuss.elastic.co/t/problem-with-zipcode/19880/2 "2014-09-19T09:16:33Z")

</div>

What gives GET /yourindex/\_mapping

Your mapping definition does look like a mapping here

--  
David Pilato | Technical Advocate | [elasticsearch.com](http://elasticsearch.com)  
[david.pilato@elasticsearch.com](mailto:david.pilato@elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 19 septembre 2014 à 10:44:31, Hari Rajaonarifetra ([rhari44@gmail.com](mailto:rhari44@gmail.com)) a écrit:

Hi,

I have a big problem with zipcode.

See below my config :

ville:  
mappings:  
ville\_nom:  
index\_analyzer : cities\_index\_analyzer  
search\_analyzer : cities\_search\_analyzer  
type : string  
ville\_cp:  
type: string  
index: not\_analyzed

But when I run "populate", elasticsearch cut the 0 on the begining of ville\_cp (03000 =\> 3000).

Someone can help me?

## Thanks, Hari

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/0348b69f-5418-4c9d-9f9e-e3ce2425a0fb%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0348b69f-5418-4c9d-9f9e-e3ce2425a0fb%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](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 [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/etPan.541bf471.2eb141f2.18d1%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.541bf471.2eb141f2.18d1%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Hari\_Rajaonarifetra](https://avatars.discourse-cdn.com/v4/letter/h/ee7513/32.png) [@Hari\_Rajaonarifetra](https://discuss.elastic.co/u/Hari_Rajaonarifetra)\
**Post date:** [September 19, 2014, 12:05pm UTC](https://discuss.elastic.co/t/problem-with-zipcode/19880/3 "2014-09-19T12:05:59Z")

</div>

> Thanks for your answer.

GET /ville/\_mapping gives this :

1. {  
"my\_project":  
{  
"mappings":  
{  
"ville":  
{  
"\_meta":  
{  
"model": "MyProject\ReferenceBundle\Entity\Ville"  
},  
"properties":  
{  
"ville\_cp":  
{  
"type": "string",  
"index": "not\_analyzed",  
"store": true  
},  
"ville\_id":  
{  
"type": "long"  
},  
"ville\_nom":  
{  
"type": "string",  
"store": true,  
"index\_analyzer": "cities\_index\_analyzer",  
"search\_analyzer": "cities\_search\_analyzer"  
}  
}  
}  
}  
}  
}

--  
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/4ff68968-2d01-41cb-96be-deb51ebc4119%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4ff68968-2d01-41cb-96be-deb51ebc4119%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [September 19, 2014, 12:08pm UTC](https://discuss.elastic.co/t/problem-with-zipcode/19880/4 "2014-09-19T12:08:25Z")

</div>

Could you GIST a full SENSE script which helps to reproduce your issue?

--  
David Pilato | Technical Advocate | [elasticsearch.com](http://elasticsearch.com)  
[david.pilato@elasticsearch.com](mailto:david.pilato@elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 19 septembre 2014 à 14:06:04, Hari Rajaonarifetra ([rhari44@gmail.com](mailto:rhari44@gmail.com)) a écrit:

Thanks for your answer.

GET /ville/\_mapping gives this :

## { "my\_project": { "mappings": { "ville": { "\_meta": { "model": "MyProject\ReferenceBundle\Entity\Ville" }, "properties": { "ville\_cp": { "type": "string", "index": "not\_analyzed", "store": true }, "ville\_id": { "type": "long" }, "ville\_nom": { "type": "string", "store": true, "index\_analyzer": "cities\_index\_analyzer", "search\_analyzer": "cities\_search\_analyzer" } } } } } }

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/4ff68968-2d01-41cb-96be-deb51ebc4119%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4ff68968-2d01-41cb-96be-deb51ebc4119%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](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 [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/etPan.541c1cb9.643c9869.1f5f%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.541c1cb9.643c9869.1f5f%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Hari\_Rajaonarifetra](https://avatars.discourse-cdn.com/v4/letter/h/ee7513/32.png) [@Hari\_Rajaonarifetra](https://discuss.elastic.co/u/Hari_Rajaonarifetra)\
**Post date:** [September 19, 2014, 12:08pm UTC](https://discuss.elastic.co/t/problem-with-zipcode/19880/5 "2014-09-19T12:08:34Z")

</div>

There was something wrong in what I did ?

Thanks a lot,

--  
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/a650a6b1-4454-49ec-8dd2-28e8fa59ec81%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a650a6b1-4454-49ec-8dd2-28e8fa59ec81%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Hari\_Rajaonarifetra](https://avatars.discourse-cdn.com/v4/letter/h/ee7513/32.png) [@Hari\_Rajaonarifetra](https://discuss.elastic.co/u/Hari_Rajaonarifetra)\
**Post date:** [September 19, 2014, 12:39pm UTC](https://discuss.elastic.co/t/problem-with-zipcode/19880/6 "2014-09-19T12:39:56Z")

</div>

> After populating index with this mapping, I just use  
> [http://localhost:9200/\_plugin/head/](http://localhost:9200/_plugin/head/) for testing query.

But when I try to find a city with zipcode:03000 (for example), there is no  
result. I check the index with the head navigator and I see that all  
zipcode beginning with "0" is cut and indexed without "0" (03000 =\> 3000).

--  
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/8ee8a161-11e4-4394-a3c2-5ce0f768894a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8ee8a161-11e4-4394-a3c2-5ce0f768894a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jxerome](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jxerome/32/44932_2.png) [@jxerome](https://discuss.elastic.co/u/jxerome)\
**Post date:** [September 21, 2014, 7:19pm UTC](https://discuss.elastic.co/t/problem-with-zipcode/19880/7 "2014-09-21T19:19:41Z")

</div>

Hello,

Since your mapping seems valid, I suppose that the zipcode is cast to an  
integer during indexation process, when building the document sent to ES.  
Could you check the document source of "Moulins" by the CRUD get query ?

GET /ville/ville/

--  
Jérôme Mainaud  
[jerome@mainaud.com](mailto:jerome@mainaud.com)

2014-09-19 14:39 GMT+02:00 Hari Rajaonarifetra [rhari44@gmail.com](mailto:rhari44@gmail.com):

> > After populating index with this mapping, I just use  
> > [http://localhost:9200/\_plugin/head/](http://localhost:9200/_plugin/head/) for testing query.
> 
> But when I try to find a city with zipcode:03000 (for example), there is  
> no result. I check the index with the head navigator and I see that all  
> zipcode beginning with "0" is cut and indexed without "0" (03000 =\> 3000).
> 
> --  
> 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/8ee8a161-11e4-4394-a3c2-5ce0f768894a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8ee8a161-11e4-4394-a3c2-5ce0f768894a%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/8ee8a161-11e4-4394-a3c2-5ce0f768894a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/8ee8a161-11e4-4394-a3c2-5ce0f768894a%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](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 [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAJXyu8n67Ab%2BBgCCfUWT222zxUpbhXD2We1GUeRLKV4diKSvhg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAJXyu8n67Ab%2BBgCCfUWT222zxUpbhXD2We1GUeRLKV4diKSvhg%40mail.gmail.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:00am UTC](https://discuss.elastic.co/t/problem-with-zipcode/19880/8 "2017-07-06T01:00:50Z")

</div>

Closed on July 6, 2017, 1:00am UTC


