我遇到了一些严重的问题,一个定制的搜索。我想要的只是三个字段中的通配符搜索,结果应该被另一个字段过滤。在Elastica中,它将产生以下查询:
{
"bool":{
"should":[
{
"wildcard":{
"ean":"*180g*"
}
},
{
"wildcard":{
"titel":"*180g*"
}
},
{
"wildcard":{
"interpret":"*180g*"
}
}
],
"filter":[
{
"term":{
"genre":{
"value":"Rock",
"boost":1
}
}
}
]
}
}实际上我找不到一个错误,但是Elasticsearch没有给我过滤的结果。会发生什么?Elasticsearch返回带过滤项的所有项,如果布尔值应该是True或False。当我将过滤器添加为“必须”时,我得到的结果是相同的?这里怎么了!?
发布于 2017-09-29 11:38:18
您需要在"minimum_should_match": 1查询中添加bool。
{
"bool":{
"minimum_should_match": 1,
"should":[
{
"wildcard":{
"ean":"*180g*"
}
},
{
"wildcard":{
"titel":"*180g*"
}
},
{
"wildcard":{
"interpret":"*180g*"
}
}
],
"filter":[
{
"term":{
"genre":{
"value":"Rock",
"boost":1
}
}
}
]
}
}https://stackoverflow.com/questions/46487849
复制相似问题