package alien4cloud.paas.model;

import java.util.Date;

import org.elasticsearch.annotation.DateField;
import org.elasticsearch.annotation.ESObject;
import org.elasticsearch.annotation.StringField;
import org.elasticsearch.annotation.TimeStamp;
import org.elasticsearch.annotation.query.TermFilter;
import org.elasticsearch.mapping.IndexType;

import com.fasterxml.jackson.annotation.JsonInclude;

import lombok.Getter;
import lombok.Setter;

/**
 * This represents a log entry from orchestrator
 */
@Getter
@Setter
@ESObject
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PaaSDeploymentLog {

    /**
     * Deployment PaaS id is unique for an application on a given environment (for ex : Alien-Prod)
     * It corresponds to {@link alien4cloud.model.deployment.Deployment#getOrchestratorDeploymentId}
     * This field is mandatory
     */
    @TermFilter
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private String deploymentPaaSId;

    /**
     * Log's level
     * This field is mandatory
     */
    @TermFilter
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private PaaSDeploymentLogLevel level;

    /**
     * The type of the log entry given by the PaaS
     * For cloudify it can be a4c_workflow_event, Task sent, Task started etc ...
     * For puccini it can be operation_output, operation_info, plugin, provider, general ...
     * This field is mandatory
     */
    @TermFilter
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private String type;

    /**
     * Log's timestamp
     * This field is mandatory
     */
    @TermFilter
    @DateField
    @TimeStamp(format = "", index = IndexType.not_analyzed)
    private Date timestamp;

    /**
     * Id of the workflow that generated the log
     * This field is optional
     */
    @TermFilter
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private String workflowId;

    /**
     * Id of the execution that generated the log
     * This field is optional
     */
    @TermFilter
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private String executionId;

    /**
     * Id of the node that generated the log
     * This field is optional
     */
    @TermFilter
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private String nodeId;

    /**
     * Id of the instance that generated the log
     * This field is optional
     */
    @TermFilter
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private String instanceId;

    /**
     * Interface on the node that generated the log
     * This field is optional
     */
    @TermFilter
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private String interfaceName;

    /**
     * Operation inside the interface on the node that generated the log
     * This field is optional
     */
    @TermFilter
    @StringField(indexType = IndexType.not_analyzed, includeInAll = false)
    private String operationName;

    /**
     * Finally the log's content in free text
     * This field is mandatory
     */
    @StringField
    private String content;

    @Override
    public String toString() {
        return "PaaSDeploymentLog{" + "deploymentPaaSId='" + deploymentPaaSId + '\'' + ", level=" + level + ", type='" + type + '\'' + ", timestamp="
                + timestamp + ", workflowId='" + workflowId + '\'' + ", executionId='" + executionId + '\'' + ", nodeId='" + nodeId + '\'' + ", instanceId='"
                + instanceId + '\'' + ", interfaceName='" + interfaceName + '\'' + ", operationName='" + operationName + '\'' + ", content='" + content + '\''
                + '}';
    }
}

@@ -289,24 +289,78 @@
 TermFilter;%0A
+import org.elasticsearch.annotation.query.TermsFacet;%0A
 import org.e
@@ -391,16 +391,16 @@
 exType;%0A
-
 %0Aimport 
@@ -1102,32 +1102,48 @@
     @TermFilter%0A
+    @TermsFacet%0A
     @StringField
@@ -1525,32 +1525,48 @@
     @TermFilter%0A
+    @TermsFacet%0A
     @StringField
@@ -1943,32 +1943,48 @@
     @TermFilter%0A
+    @TermsFacet%0A
     @StringField
@@ -2178,32 +2178,48 @@
     @TermFilter%0A
+    @TermsFacet%0A
     @StringField
@@ -2409,32 +2409,48 @@
     @TermFilter%0A
+    @TermsFacet%0A
     @StringField
@@ -2639,32 +2639,48 @@
     @TermFilter%0A
+    @TermsFacet%0A
     @StringField
@@ -2876,32 +2876,48 @@
     @TermFilter%0A
+    @TermsFacet%0A
     @StringField
@@ -3121,32 +3121,32 @@
 ptional%0A     */%0A
-
     @TermFilter%0A
@@ -3137,32 +3137,48 @@
     @TermFilter%0A
+    @TermsFacet%0A
     @StringField

Fix model