# Mapping problem, date and range filter

**URL:** <https://discuss.elastic.co/t/mapping-problem-date-and-range-filter/21392>\
**Category:** Elasticsearch\
**Created:** [December 25, 2014, 11:50pm UTC](https://discuss.elastic.co/t/mapping-problem-date-and-range-filter/21392 "2014-12-25T23:50:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Finn\_Poitier](https://avatars.discourse-cdn.com/v4/letter/f/ccd318/32.png) [@Finn\_Poitier](https://discuss.elastic.co/u/Finn_Poitier)\
**Post date:** [December 25, 2014, 11:50pm UTC](https://discuss.elastic.co/t/mapping-problem-date-and-range-filter/21392/1 "2014-12-25T23:50:31Z")

</div>

When I have a wrong mapping (type = string, not date) like this one

created\_at: {  
type: string  
}

and the entries look like:

Sun Oct 05 23:15:22 +0000 2014

I guess I can't use the range query to get documents for a certain time  
span?

It would work to search for a string, such as "Sun Oct 05" to get all  
documents of that day but can you imagine of any way in this situation to  
get the documents for example for

Tue Aug 26 to Sun Oct 05 ?

I'm afraid I have to reindex the index to the propper date mapping, hm, no  
experiences on that, what would be the easiest way to do that for about 60  
million documents?

Thanks for your help!

--  
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/f53a7c30-92f3-4f97-9930-d88fc9945c7e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f53a7c30-92f3-4f97-9930-d88fc9945c7e%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:** [December 26, 2014, 6:20am UTC](https://discuss.elastic.co/t/mapping-problem-date-and-range-filter/21392/2 "2014-12-26T06:20:41Z")

</div>

Yeah. You should reindex.  
You could use scan&scroll API to read your index and then write results in another one.

IIRC there are some scripts and plugins on internet.

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

> Le 26 déc. 2014 à 00:50, Finn Poitier [finnpoitier@googlemail.com](mailto:finnpoitier@googlemail.com) a écrit :
> 
> When I have a wrong mapping (type = string, not date) like this one
> 
> created\_at: {  
> type: string  
> }
> 
> and the entries look like:
> 
> Sun Oct 05 23:15:22 +0000 2014
> 
> I guess I can't use the range query to get documents for a certain time span?
> 
> It would work to search for a string, such as "Sun Oct 05" to get all documents of that day but can you imagine of any way in this situation to get the documents for example for
> 
> Tue Aug 26 to Sun Oct 05 ?
> 
> I'm afraid I have to reindex the index to the propper date mapping, hm, no experiences on that, what would be the easiest way to do that for about 60 million documents?
> 
> Thanks for your help!
> 
> --  
> 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/f53a7c30-92f3-4f97-9930-d88fc9945c7e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f53a7c30-92f3-4f97-9930-d88fc9945c7e%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/97D6D880-5D30-452D-ABAA-84B35918DEB9%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/97D6D880-5D30-452D-ABAA-84B35918DEB9%40pilato.fr).  
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, 12:41am UTC](https://discuss.elastic.co/t/mapping-problem-date-and-range-filter/21392/3 "2017-07-06T00:41:57Z")

</div>


