【the waiter】announcement:

Es to struct
1648  |   |   |  1

feature introduction

  1. Change the contents of properties in mapping to struct
  2. Note that the value of properties is used as input, as follows:
{
    "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"
            }
        }
    }
}

example

{
    "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"
    }
}

After treatment

type GenerateObj struct {
    DocId string `json:"doc_id,omitempty"`
    Id int64 `json:"id,omitempty"`
    Path string `json:"path,omitempty"`
    Name string `json:"name,omitempty"`
    Url string `json:"url,omitempty"`
    Description string `json:"description,omitempty"`
    CreatedTime string `json:"created_time,omitempty"`
}