python - ElasticSearch DSL -> 组合多个过滤器并消除元数据
问题描述
以下查询假设返回 product_id 为 12 的文档。
request = Search(using=client, index='myIndex') \
.filter("match",product_id=12) \
.source(myFieldsArray)
现在我还想删除所有parent
为空的文档。
我还希望不返回元数据,只返回实际数据(在我filter_path=hits.hits._source.*
在查询字符串上使用的 kopf 上)
我如何在弹性搜索 dsl 上执行这些操作?
详细信息:使用 Elasticsearch 2.4
解决方案
过滤器可以链接,就在.filter(
外面。为了消除元数据,您必须设置params
类似.params(filter_path="hits.hits._source.*")
推荐阅读
- python - 如何在 Django 中动态生成模型和表
- xamarin.forms - Xamarin - 如何在集合视图中调用函数而不出错?
- scala - Spark、Scala、Databricks、组合和添加列
- magento - Magento 2 - 返回产品列表的 GraphQL 自定义解析器
- c# - C# SAP .net 连接器未返回与 SAP GUI 中相同的数据
- r - 绘制特定行的每个列值
- javascript - 多个 Splide 滑块
- reactjs - IntelliSense 工具提示在 vscode 中悬停时未显示正确的 Typescript 事件类型
- css - sl 按钮不是已知元素 - 将 css 库导入 Angular
- php - 无法让 mod_rewrite 在 docker 容器中工作