【ES】简单使用
ES 简单 使用
2023-09-27 14:24:24 时间
1 import sys 2 reload(sys) 3 sys.setdefaultencoding('utf-8') 4 5 from datetime import datetime 6 from elasticsearch import Elasticsearch 7 from os import path 8 import jieba 9 import random 10 es = Elasticsearch() 11 12 filePath = path.dirname(__file__) 13 14 15 # index1:wordcount 16 # stopwords 17 stopWordFile = u'stopwords.txt' 18 stopWordList = [] 19 for L in open(path.join(filePath , stopWordFile)).readlines(): 20 stopWordList.append(L.strip().decode('utf-8')) 21 stopWordList.extend([u'腾讯',u'视频' , u'。']) 22 stopWordList = set(stopWordList) 23 24 # information words 25 new = 'words.txt' 26 text = open(path.join( filePath , new )).read().strip('\r') 27 wordDict = {} 28 for w in jieba.cut(text): 29 if w not in stopWordList: 30 wordDict.setdefault(w , 0) 31 wordDict[w] += 1 32 33 for key in wordDict.keys(): 34 data = {'word':key , 'count':wordDict[key]} 35 es.index(index = 'wordcount' , doc_type = 'test' , body = data) 36
相关文章
- Mali GPU OpenGL ES 应用性能优化--基本方法
- kubernetes-event-exporter,轻松将 K8s 的 Event 导出到ES中
- ES 内存管理分析
- pg统计入ES
- ElasticSearch入门之es使用shell命令操作索引,curl操作索引 08
- ElasticSearch第五讲 ES nested嵌套文档与父子文档处理
- ES常用维护命令
- ES集群状态yellow修复
- 《OpenGL ES 3.x游戏开发(上卷)》一2.7 小结
- 《OpenGL ES 2.0游戏开发(上卷):基础技术和典型案例》——6.3节定位光与定向光
- js版本规范的表示:ES6 == ES 6 == ECMAScript 6 == ECMA-262 6
- 《OpenGL ES应用开发实践指南:Android卷》—— 2.4 使数据可以被OpenGL存取
- 《OpenGL ES应用开发实践指南:Android卷》—— 2.6 OpenGL颜色模型
- 《OpenGL ES应用开发实践指南:Android卷》——第3章 编译着色器及在屏幕上绘图
- ES 自动恢复分片的时候不恢复了是磁盘超过了85%,然后不恢复了 ES可以配置多个数据目录
- 【OpenGL ES】EGL+FBO离屏渲染
- es及kibana下载地址
- ES 安全认证模块之XPack