elasticsearch - 用于查找未回答问题的弹性搜索查询
问题描述
我需要使用字段“user_response”:[]”找到未回答的问题总数。我没有得到任何计数。
我的要求是如果 User_Response 为空白或不可用,那么这应该是我未回答的问题
我在下面的查询中写了这个但没有得到它给我的计数 0
GET/activity_tracking/_search
{
"size": 0,
"query": {
"bool": {
"must": [
{
"term": {
"user_response": "[ ]"
}
}
]
}
}
}
以下是映射细节
{
"user_response": {
"properties": {
"qid": {
"type": "Keyword",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
解决方案
在查询中使用存在函数
GET /_search
{
"query": {
"bool": {
"must_not": {
"exists": {
"field": "user_response.qid"
}
}
}
}
}
推荐阅读
- javascript - Opening the javascript action only when clicking a specific section of the div
- ansible - 查找 webservice (uri) 返回的 JSON 中的值
- javascript - PegJS 数学解析
- laravel - 升级到 Laravel 5.8 后 Dotenv 模块运行 Laravel Dusk 的问题
- javascript - 如何从 Angular httpClient 发送图像和 JSON
- node.js - AWS Lambda node-soap 函数(无服务器框架)
- python - 如何将自定义数据集加载到胶囊网络?
- java - 在上下文中获取 NullPointerException
- postgresql - 用 for 选择不同并插入 plpgsql 函数
- c++ - Visual Studio 2017 - 通过命令行和 MSBuild 构建 - 缺少 stdafx.h