python-3.x - ElasticSearch查询传递python动态变量
问题描述
res = es.search(index="resume", body={"query": {"match" : {"resume_file_text" : '"+key+"'}}})
如何传递变量'key'它保存用户在UI上给出的值并动态变化?
解决方案
正文是哈希而不是字符串(因此无需连接任何内容)。所以你可以这样做:
res = es.search(index="resume", body={"query": {"match" : {"resume_file_text" : key}}})
推荐阅读
- android - Android - Fragment 中的 GlSurfaceView 同时运行两次
- mongodb - Mongodb-Query db 使用来自另一个查询的结果
- r - 递归读取csv文件并对两个文件进行计算
- java - 为什么部署后在 RESTEasy (wildfly) 上出现 404 错误?
- python-3.x - 无法从 Python 中的 Beautifulsoup 中转义值
- javascript - 在本地环境中运行时,ghostscript 转换不会创建输出文件
- python-3.x - 全局变量未正确定义 [PYTHON 3]
- ubuntu - 如何制作“Hello world”内核
- java - 标准 GAE 上的 Java 应用程序随机出现空间不足。如何设置堆?
- javascript - Firestore 批量写入是否会在失败时自动重新运行?