我在弹性搜索中有以下记录
{
"label": "/home and garden/home furnishings",
"score": "0.731174"
},
{
"label": "/travel/vacation rentals",
"score": "0.601932"
},
{
"label": "/travel/vacation rentals",
"score": "0.657443"
},
{
"label": "/home and garden/gardening and landscaping/yard and patio",
"score": "0.707792"
}
现在我想进行查询以获取以" / travel"开头的所有分类标签。我只希望数据直到第三个正斜杠
示例如果我们采取
"label": "/home and garden/gardening and landscaping/yard and patio"
然后我只想要数据
/home and garden/gardening and landscaping/
我尝试了一些部分匹配的查询,如:
{
"_source":["taxonomy"],
"from" : 0,
"size" : 100,
"query": {
"regexp":{
"taxonomy.label":{
"value":"/travel.*",
"boost":1.2
}
}
}
}
但是,一旦我给斜杠它停止给出任何结果,它似乎没有采用正斜线,我想知道这是否可能,如果是,那么我如何继续这个查询?
感谢任何帮助。
答案 0 :(得分:0)