ES 转 Java 工具 | 在线 ES 文档转 Java 实体类生成器 | GoTool在线工具集

高效后端开发工具系列 - 指南与案例

😫 核心痛点

免费在线 ES 转 Java 工具,快速将 Elasticsearch 文档结构转换为 Java 实体类。支持字段映射、类型自动转换、代码生成,提高开发效率。。在实际开发中,这些琐碎的转换或配置工作往往消耗大量精力且容易引入错误。GoTool 为此提供了快速、准确且免费的在线解决方案。

💡 功能亮点 & 使用方案

功能介绍

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;
    }

}