🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[Elasticsearch集群和索引常用命令](https://www.cnblogs.com/pilihaotian/p/5846173.html) 上述链接是http的api操作说明,包含创建索引、查看索引、查看集群信息等 ### Python客户端操作 es2.0版本: [elasticsearch-py](http://elasticsearch-py.readthedocs.io/en/2.0.0/) - 引入es模块 ``` from elasticsearch import Elasticsearch ``` - 定义es链接及变量 ``` doc_type = 'log' es = Elasticsearch(urls = ['http://192.168.1.108:9200','http://192.168.1.106:9200'], timeout = 60, max_retries = 0) ``` - 创建索引 ``` es.index(index = 'app-log', doc_type='log', body = mapping) ```