# -*- coding: utf-8 -*-
from elasticsearch import Elasticsearch
es = Elasticsearch(hosts="10.109.24.153", port=9200)
es.indices.create(index="cggg", ignore=400)
data = {"name": "小明", "age": "8", "gender": "男"}
res = es.index(index="cggg", doc_type="doc", body=data)
print(res)
本文介绍如何使用Python的Elasticsearch库连接到Elasticsearch服务器,创建一个名为'cggg'的索引,并插入包含人物基本信息的数据。
2万+

被折叠的 条评论
为什么被折叠?



