django - 获取 2 列的所有值
问题描述
我正在寻找合适的弹性搜索查询,
SELECT col1,col2 FROM myTable WHERE col1="value1" AND col2 = "value2"
例如:这是我的映射,
{
"mapping": {
"doc": {
"properties": {
"book": {
"properties": {
"name": {
"type": "text"
},
"price": {
"type": "integer"
},
"booktype": {
"properties": {
"booktype": {
"type": "text"
}
}
}
}
}
}
}
}
}
我正在尝试编写一个查询,它会给我price
并且name
有booktype=Fiction
解决方案
试试这个:
GET myTable/_search
{
"size": 1000,
"_source": [
"price",
"name"
],
"query": {
"bool": {
"must": [
{
"match": {
"booktype.booktype": "Fiction"
}
}
]
}
}
}
注意:您可能需要调整“大小”以满足您的需求。
推荐阅读
- php - 数组中的元素不适用于 in_array
- c# - 如何使用 c# 在 Unity 中移动到下一个级别/场景
- reactjs - 动态文件源 React-PDF (Hooks)
- python - 尝试求解 x 时获取“int”对象不可迭代
- c++ - 当我通过代码arduino esp32传递命令时,sim800 cme erro2
- node.js - 如何解决 mongoddb adbpter 查询构建问题中的 $near 查询?
- node.js - nodejs writeFile 仅适用于管理员权限
- r - R通过将事物组合在一起制作百分比的pi图
- python - 在 EventGhost 中使用 Python
- python - 获取网站部分的 id 或 xpath