summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/lib/Elastica/Aggregation/DateHistogram.php
blob: 8636f34ca8513ab71136f9810b5e989ff911a132 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
namespace Elastica\Aggregation;

/**
 * Class DateHistogram.
 *
 * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html
 */
class DateHistogram extends Histogram
{
    /**
     * Set pre-rounding based on interval.
     *
     * @deprecated Option "pre_zone" is deprecated as of ES 1.5. Use "time_zone" instead
     *
     * @param string $preZone
     *
     * @return $this
     */
    public function setPreZone($preZone)
    {
        return $this->setParam('pre_zone', $preZone);
    }

    /**
     * Set post-rounding based on interval.
     *
     * @deprecated Option "post_zone" is deprecated as of ES 1.5. Use "time_zone" instead
     *
     * @param string $postZone
     *
     * @return $this
     */
    public function setPostZone($postZone)
    {
        return $this->setParam('post_zone', $postZone);
    }

    /**
     * Set time_zone option.
     *
     * @param  string
     *
     * @return $this
     */
    public function setTimezone($timezone)
    {
        return $this->setParam('time_zone', $timezone);
    }

    /**
     * Set pre-zone adjustment for larger time intervals (day and above).
     *
     * @deprecated Option "pre_zone_adjust_large_interval" is deprecated as of ES 1.5
     *
     * @param string $adjust
     *
     * @return $this
     */
    public function setPreZoneAdjustLargeInterval($adjust)
    {
        return $this->setParam('pre_zone_adjust_large_interval', $adjust);
    }

    /**
     * Adjust for granularity of date data.
     *
     * @param int $factor set to 1000 if date is stored in seconds rather than milliseconds
     *
     * @return $this
     */
    public function setFactor($factor)
    {
        return $this->setParam('factor', $factor);
    }

    /**
     * Set the offset for pre-rounding.
     *
     * @deprecated Option "pre_offset" is deprecated as of ES 1.5. Use "offset" instead
     *
     * @param string $offset "1d", for example
     *
     * @return $this
     */
    public function setPreOffset($offset)
    {
        return $this->setParam('pre_offset', $offset);
    }

    /**
     * Set the offset for post-rounding.
     *
     * @deprecated Option "post_offset" is deprecated as of ES 1.5. Use "offset" instead
     *
     * @param string $offset "1d", for example
     *
     * @return $this
     */
    public function setPostOffset($offset)
    {
        return $this->setParam('post_offset', $offset);
    }

    /**
     * Set offset option.
     *
     * @param  string
     *
     * @return $this
     */
    public function setOffset($offset)
    {
        return $this->setParam('offset', $offset);
    }

    /**
     * Set the format for returned bucket key_as_string values.
     *
     * @link http://www.elastic.co/guide/en/elasticsearch/reference/master/search-aggregations-bucket-daterange-aggregation.html#date-format-pattern
     *
     * @param string $format see link for formatting options
     *
     * @return $this
     */
    public function setFormat($format)
    {
        return $this->setParam('format', $format);
    }
}