Elasticsearch 6.2 按数组搜索每个项目
Elasticsearch 6.2 search by array each item
我有这样的数组设置,
"title": "Living furniture exhibitions!"
"include_products": ["ikea chair", "marketO desk"]
我试着这样搜索。
{
"query": {
"multi_match": {
"query": "ikea desk",
"operator": "and"
}
}
}
我不想要任何搜索结果。但是,它搜索了 [[ikea chair", "marketO desk"]。
如何搜索 include_products 数组中的每一项?
另外,我的映射设置是这样的,
"mappings": {
"information" : {
"properties" : {
"title" : {
"type" : "text"
},
"include_products": {
"type": "text"
}
},
"_all": {
"enabled": false
}
}
}
试试这个
{
"query":{
"bool":{
"must":[
{
"match_phrase":{
"include_products":"ikea desk"
}
}
]
}
}
}
我有这样的数组设置,
"title": "Living furniture exhibitions!"
"include_products": ["ikea chair", "marketO desk"]
我试着这样搜索。
{
"query": {
"multi_match": {
"query": "ikea desk",
"operator": "and"
}
}
}
我不想要任何搜索结果。但是,它搜索了 [[ikea chair", "marketO desk"]。
如何搜索 include_products 数组中的每一项?
另外,我的映射设置是这样的,
"mappings": {
"information" : {
"properties" : {
"title" : {
"type" : "text"
},
"include_products": {
"type": "text"
}
},
"_all": {
"enabled": false
}
}
}
试试这个
{
"query":{
"bool":{
"must":[
{
"match_phrase":{
"include_products":"ikea desk"
}
}
]
}
}
}