Hi Abhishek,

I'll probably do a previous step to process the day by line (like
yyyy-MM-dd).
And just do
JavaEsSpark.saveJsonToEs(jrd, "index_{date}/type");

If the range is needed I'll probably do the same. Add a feature with {time}
- {time} % 86400}_{ {time} + 86400 - {date} % 86400 } and just
index_{my_new_feature}

It adds a step and a feature in the doc but it's simple to do.

Julien

2015-02-02 15:13 GMT+01:00 Abhishek Patel <present.boiling2...@gmail.com>:

> Hi Julien,
>
> I am trying to achieve something similar. In my case, my JSON contains a
> field "time" in Unix time. And i want to partition my indexes by this
> field. That is, if one JSON1 contains 1422904680 in "time" and JSON2
> contains 1422991080 in time, then i want to create indexes which are
> partitioned by time (24 hours) like
>
> index_1422835200_1422921599 - which will contain JSON1 because value of
> "time" = 1422904680 falls in its range.
> index_1422921600_1423007999 - which will contain JSON2 because value of
> "time" = 1422991080 falls in its range.
>
> Now I want to create my indexes dynamically. There is also possibility of
> receiving a JSON which contain a value of time before current date.
>
> To achieve this, I need to create index name dynamically by calculating it
> at the time of creation then and there itself. Programmatically, I want to
> achieve something like this
>
>  JavaEsSpark.saveJsonToEs(jrd, "index_{time} - {time} % 86400}_{ {time} +
> 86400 - {date} % 86400 }/type");
>
> Is it possible to achieve dynamic index name creation as described above?
> If no, is there any work around to achieve my use case.
>
> Thanks
> Abhishek
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "elasticsearch" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/elasticsearch/5-LwjQxVlhk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> elasticsearch+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/2326fa57-63d9-4b9c-8b71-b1c8b2b0e061%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/2326fa57-63d9-4b9c-8b71-b1c8b2b0e061%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit 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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAFGA2c3fFGtSpTtpR9tD%2BsfwjuRDftHTK7y2QUHUYEhH5iwkWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to