【发布时间】:2015-03-03 07:55:10
【问题描述】:
我的数据库中充满了这样的文件:
{
_index: "bla_bla",
.
.
.
_source: {
domain: "somedomain.extension",
path: "/you/know/the/path",
lang: "en",
keywords: ["yeah", "you", "rock", "dude", "help", "me", "good", "samaritan"]
}
}
当我搜索时——不管我在寻找什么——它就像一个魅力,但是,如果我尝试通过使用名为 path 的字段来过滤某些东西——它——只是——不会'不工作;没有一个错误或警告被抛出。经过艰苦的研究,我想这是因为路径开头的斜线,我是否正确,但无论如何我需要像这样过滤:
{
"query": {
"filtered": {
"filter": {
"bool": {
"should": {
"terms": {
"keywords": ["stackoverflow", "rocks", "!"]
}
},
"must_not": {
"term": {
"path": "/"
// This works, i.e -> "lang": "en"
}
}
}
}
}
},
"from": 0,
"size": 9
}
TL;DR:拥有 urls 的数据库,我怎样才能只获得 non-root [路径长于“ /"] 的?
【问题讨论】:
标签: string elasticsearch search filter nosql