go在線工具集
首頁
搜索
致boss

es轉java
6  |   |   |  1

功能介紹

1.將 mapping 中的 properties 內容轉為 struct, 如下:

{
    "mappings": {
        "properties": {
            "doc_id": {
                "type": "keyword"
            },
            "id": {
                "type": "long"
            },
            "path": {
                "type": "keyword"
            },
            "name": {
                "type": "text"
            },
            "url": {
                "type": "keyword"
            },
            "description": {
                "type": "text"
            },
            "created_time": {
                "type": "date",
                "format": "yyyy-MM-dd HH:mm:ss"
            }
        }
    }
}

處理後

public class Es2StructTmp {
    private String created_time;
    private String description;
    private String doc_id;
    private Integer id;
    private String name;
    private String path;
    private String url;
    public String getCreated_time() {
        return this.created_time;
    }

    public void setCreated_time(String created_time) {
        this.created_time = created_time;
    }

    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getDoc_id() {
        return this.doc_id;
    }

    public void setDoc_id(String doc_id) {
        this.doc_id = doc_id;
    }

    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPath() {
        return this.path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getUrl() {
        return this.url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

}