字段objecttype:keyword类型,保存了不同商品类型,比如雪糕、白酒、啤酒、饼干
字段description:text类型
一个查询需求为查询objecttype为雪糕,并且description中包含“糖”的结果。
这个应该怎么写呢?
字段objecttype:keyword类型,保存了不同商品类型,比如雪糕、白酒、啤酒、饼干
字段description:text类型
一个查询需求为查询objecttype为雪糕,并且description中包含“糖”的结果。
这个应该怎么写呢?
可以这样写:
POST YOUR_INDEX/_search
{
"query": {
"bool": {
"must": [
{
"terms": {
"objecttype": [
"雪糕"
]
}
},
{
"match": {
"description": "糖"
}
}
]
}
}
}
注意:description最好有分词