How to write an interval that groups by every half a month? Rather than 1M I want something like 1/2M to group by from the first to the 16th and from the 16th to the end of the month, every month. Is there a way to do so?
I don't want to end up doing an interval on each day and then calculate manually my results as it's not clean and it would be resource hungry, is there a simple way to do so using setInterval? (in Elasticsearch or Elastica I don't care, I just want the algorithm behind it, thanks!)
$date_grp_agg = new \Elastica\Aggregation\DateHistogram('date');
$date_grp_agg->setField('date')->setFormat("MM-yy")->setInterval('1M'); // This one
The only way is to use days but this will give approximative results in a sense that splitting in 15d in January will left one day that will go in 1st half of February.
The other way would be by indexing a text field like "date": "Jan1", "date": "Jan2","date": "Feb1", "date": "Feb2" and compute that value at index time based on your rules and calendar rules like some months of february have 28 days while others might have 29 days...
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.