# Index json file with new Date field

**URL:** <https://discuss.elastic.co/t/index-json-file-with-new-date-field/13148>\
**Category:** Elasticsearch\
**Created:** [August 9, 2013, 9:59am UTC](https://discuss.elastic.co/t/index-json-file-with-new-date-field/13148 "2013-08-09T09:59:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maarten\_Roosendaal](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@Maarten\_Roosendaal](https://discuss.elastic.co/u/Maarten_Roosendaal)\
**Post date:** [August 9, 2013, 9:59am UTC](https://discuss.elastic.co/t/index-json-file-with-new-date-field/13148/1 "2013-08-09T09:59:46Z")

</div>

Hi,

I've got a large json file which contains information i need to index, each  
entry looks like this:  
{"\_id":"1002004000002182","createDate":new  
Date(1208563200000),"modifiedContentDate":new Date(1360281600000),  
.................}

Is there a way to use the REST API to handle 'new Date(####)' fields as  
mentioned? Right now it seems it can't. The goal is to create a bootstrap  
mechanism to bulk-index the entire content from several large json files.

Thanks,  
Maarten

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Jerome\_Gagnon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jerome_gagnon/32/2178_2.png) [@Jerome\_Gagnon](https://discuss.elastic.co/u/Jerome_Gagnon)\
**Post date:** [August 9, 2013, 12:40pm UTC](https://discuss.elastic.co/t/index-json-file-with-new-date-field/13148/2 "2013-08-09T12:40:19Z")

</div>

Hey Maarten,

If I understand well, what you would have to do is to set the field type of  
your date field as "date" into the mapping, then instead of passing new  
Date(###) just pass ### and it will be stored as a date, which is really  
only a long in the end.

On Friday, August 9, 2013 5:59:46 AM UTC-4, Maarten Roosendaal wrote:

> Hi,
> 
> I've got a large json file which contains information i need to index,  
> each entry looks like this:  
> {"\_id":"1002004000002182","createDate":new  
> Date(1208563200000),"modifiedContentDate":new Date(1360281600000),  
> .................}
> 
> Is there a way to use the REST API to handle 'new Date(####)' fields as  
> mentioned? Right now it seems it can't. The goal is to create a bootstrap  
> mechanism to bulk-index the entire content from several large json files.
> 
> Thanks,  
> Maarten

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Maarten\_Roosendaal](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@Maarten\_Roosendaal](https://discuss.elastic.co/u/Maarten_Roosendaal)\
**Post date:** [August 9, 2013, 5:04pm UTC](https://discuss.elastic.co/t/index-json-file-with-new-date-field/13148/3 "2013-08-09T17:04:31Z")

</div>

Hi,

I thought so, the challenge is that this file contains 15 mln entries, so  
in order to do what you propose i need to preprocess this file and remove  
all new Date(##) entries but keep the ###.

Thanks,  
Maarten

Op vrijdag 9 augustus 2013 14:40:19 UTC+2 schreef Jérôme Gagnon:

> Hey Maarten,
> 
> If I understand well, what you would have to do is to set the field type  
> of your date field as "date" into the mapping, then instead of passing new  
> Date(###) just pass ### and it will be stored as a date, which is really  
> only a long in the end.
> 
> On Friday, August 9, 2013 5:59:46 AM UTC-4, Maarten Roosendaal wrote:
> 
> > Hi,
> > 
> > I've got a large json file which contains information i need to index,  
> > each entry looks like this:  
> > {"\_id":"1002004000002182","createDate":new  
> > Date(1208563200000),"modifiedContentDate":new Date(1360281600000),  
> > .................}
> > 
> > Is there a way to use the REST API to handle 'new Date(####)' fields as  
> > mentioned? Right now it seems it can't. The goal is to create a bootstrap  
> > mechanism to bulk-index the entire content from several large json files.
> > 
> > Thanks,  
> > Maarten

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:21am UTC](https://discuss.elastic.co/t/index-json-file-with-new-date-field/13148/4 "2017-07-06T02:21:50Z")

</div>


