【ElasticSearch 6.*】 学习五:数据插入

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_31617637/article/details/85102483

指定id的数据插入

请求参数(PUThttp://localhost:9200/people/man/1

{
	"name": "lih",
	"country": "china",
	"age": "28",
	"date": "1990-09-20"
}

返回数据

{
    "_index": "people",
    "_type": "man",
    "_id": "1",
    "_version": 1,
    "result": "created",
    "_shards": {
        "total": 2,
        "successful": 2,
        "failed": 0
    },
    "_seq_no": 0,
    "_primary_term": 1
}

在这里插入图片描述
head工具查看数据
在这里插入图片描述
在这里插入图片描述

不指定id插入

请求参数(POSThttp://localhost:9200/people/man

{
	"name": "mengyaoba",
	"country": "china",
	"age": "28",
	"date": "1990-09-20"
}

返回值:

{
    "_index": "people",
    "_type": "man",
    "_id": "WJ7KxWcB5L6NdnUBQBro",
    "_version": 1,
    "result": "created",
    "_shards": {
        "total": 2,
        "successful": 2,
        "failed": 0
    },
    "_seq_no": 1,
    "_primary_term": 1
}

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_31617637/article/details/85102483