* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.sa.searchdbabstraction.searchapi;
/**
* An example of elasticsearch date_histogram aggregation:
*
- * <p><pre>
+ * <p>
+ *
+ * <pre>
* {
* "aggs": {
* "my_group": {
public class DateHistogramAggregation extends AbstractAggregation {
- private String interval;
-
- private String format;
-
- @JsonProperty("time-zone")
- private String timeZone;
-
-
- public String getInterval() {
- return interval;
- }
-
- public void setInterval(String interval) {
- this.interval = interval;
- }
-
- public String getTimeZone() {
- return timeZone;
- }
+ private String interval;
- public String getFormat() {
- return format;
- }
+ private String format;
- public void setFormat(String format) {
- this.format = format;
- }
+ @JsonProperty("time-zone")
+ private String timeZone;
- public void setTimeZone(String timeZone) {
- this.timeZone = timeZone;
- }
- @Override
- public String toElasticSearch() {
- StringBuilder sb = new StringBuilder();
+ public String getInterval() {
+ return interval;
+ }
- sb.append("\"date_histogram\": {\"field\": \"");
- sb.append(field);
- sb.append("\"");
- if (interval != null) {
- sb.append(", \"interval\": \"");
- sb.append(interval);
- sb.append("\"");
+ public void setInterval(String interval) {
+ this.interval = interval;
}
- if (format != null) {
- sb.append(", \"format\": \"");
- sb.append(format);
- sb.append("\"");
+
+ public String getTimeZone() {
+ return timeZone;
}
- if (timeZone != null) {
- sb.append(", \"time_zone\": \"");
- sb.append(timeZone);
- sb.append("\"");
+
+ public String getFormat() {
+ return format;
}
- if (size != null) {
- sb.append(", \"size\": ");
- sb.append(size);
+
+ public void setFormat(String format) {
+ this.format = format;
}
- if (minThreshold != null) {
- sb.append(", \"min_doc_count\": ").append(minThreshold);
+
+ public void setTimeZone(String timeZone) {
+ this.timeZone = timeZone;
}
- sb.append("}");
- return sb.toString();
- }
+ @Override
+ public String toElasticSearch() {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append("\"date_histogram\": {\"field\": \"");
+ sb.append(field);
+ sb.append("\"");
+ if (interval != null) {
+ sb.append(", \"interval\": \"");
+ sb.append(interval);
+ sb.append("\"");
+ }
+ if (format != null) {
+ sb.append(", \"format\": \"");
+ sb.append(format);
+ sb.append("\"");
+ }
+ if (timeZone != null) {
+ sb.append(", \"time_zone\": \"");
+ sb.append(timeZone);
+ sb.append("\"");
+ }
+ if (size != null) {
+ sb.append(", \"size\": ");
+ sb.append(size);
+ }
+ if (minThreshold != null) {
+ sb.append(", \"min_doc_count\": ").append(minThreshold);
+ }
+ sb.append("}");
+
+ return sb.toString();
+ }
- @Override
- public String toString() {
- return "DateHistogramAggregation: [field=" + field + ", interval=" + interval + ", format="
- + format + ", timeZone=" + timeZone + ", size=" + size + " minThreshold=" + minThreshold;
- }
+ @Override
+ public String toString() {
+ return "DateHistogramAggregation: [field=" + field + ", interval=" + interval + ", format=" + format
+ + ", timeZone=" + timeZone + ", size=" + size + " minThreshold=" + minThreshold;
+ }
}