bulk批量建立索引python
来源:互联网 发布:西西软件手机版 编辑:程序博客网 时间:2024/06/06 08:39
# encoding=utf-8import elasticsearch.helpersfrom elasticsearch import Elasticsearchpath = '/home/fhqplzj/data/orion/news.json'es = Elasticsearch('localhost:9200')my_index, my_type = 'test_index', 'test_type'if es.indices.exists(index=my_index): es.indices.delete(index=my_index)es.indices.create(index=my_index)def map_to_actions(lines): lines = filter(lambda x: len(x) > 0, map(lambda x: x.strip(), lines)) for idx, line in enumerate(lines): yield { '_op_type': 'index', '_index': my_index, '_type': my_type, '_id': idx + 1, '_source': line }with open(path) as f: contents = f.readlines()elasticsearch.helpers.bulk(es, actions=map_to_actions(contents))
0 0
- bulk批量建立索引python
- Elasticsearch java api(五) Bulk批量索引
- Elasticsearch java api(五) Bulk批量索引
- Elasticsearch java api(五) Bulk批量索引
- Elasticsearch java api中Bulk批量索引
- Elasticsearch java api(五) Bulk批量索引
- elasticsearch bulk 批量加载索引的实例
- 批量建立索引
- Bulk 批量插入数据库
- 批量SQL(BULK SQL)
- elasticSearch批量操作bulk
- mongo bulk批量更新
- ES 批量bulk 备忘
- Bulk API-批量执行
- ORACLE Bulk Binding批量绑定
- bulk insert批量数据导入
- 批量绑定—BULK COLLECT
- 批量处理数据 bulk collect
- requests使用代理ip的方法
- 在wget获取url路径时遇到的问题
- Python定时执行任务
- struts2入门
- IOC控制反转和DI依赖注入区别
- bulk批量建立索引python
- 独木桥
- jquery 懒加载插件jquery.lazyload.js
- PHP的运行模式
- LeetCode-algorithms 10. Regular Expression Matching
- (转)关于字符编码的八个点
- OpenStack落地失败的原因及解决之道
- 算法提高 聪明的美食家
- Ubuntu16.04+Cuda8.0(gtx1060)+OpenCV2.4.13+anaconda2+caffe详细配置