elasticsearch 数组中标记的ElasticSearch筛选
我已经为他们的观众标记了一系列事件:elasticsearch 数组中标记的ElasticSearch筛选,elasticsearch,filter,elasticsearch,Filter,我已经为他们的观众标记了一系列事件: { id = 123, audiences = ["Public", "Lecture"], ... } 我尝试使用过滤进行ElasticSearch查询,这样搜索将只返回在观众数组中具有“Public”准确条目的事件(而不会返回“notpublic”的事件) 我该怎么做 这就是我到目前为止所做的,但它返回的结果为零,尽管我肯定有“公开”活动: 您可以将其用于您的内容类型 { "your_index": { "mappings": {
{ id = 123, audiences = ["Public", "Lecture"], ... }
我尝试使用过滤进行ElasticSearch查询,这样搜索将只返回在观众数组中具有“Public”准确条目的事件(而不会返回“notpublic”的事件)
我该怎么做
这就是我到目前为止所做的,但它返回的结果为零,尽管我肯定有“公开”活动:
您可以将其用于您的内容类型
{
"your_index": {
"mappings": {
"your_type": {
"properties": {
"audiences": {
"type": "string",
"index": "not_analyzed"
},
}
}
}
}
}
未分析
索引此字段,使其可搜索,但索引
值与指定的值完全相同。不要分析它
并在搜索查询中使用小写术语值根据2016年9月7日的更改更新此答案。从ES5.0开始,您应该使用
{“类型”:“关键字”,“索引”:false}
{
"your_index": {
"mappings": {
"your_type": {
"properties": {
"audiences": {
"type": "string",
"index": "not_analyzed"
},
}
}
}
}
}