作者:少少_LV | 来源:互联网 | 2022-12-01 17:12
我有一个索引,可以返回不同语言的作业.
我需要根据单个文本搜索类似的作业到单一语言.所以说,我已经为英语设置了1作为LanguageId.我想搜索与帐户匹配的工作.因此,如果我写下面的查询,它会获取所有不同语言的作业.所以基本上"必须"查询没有任何影响.
GET jobs/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"languageid": "1"
}
}
]
}
},
"suggest": {
"suggestions": {
"text": "acce",
"completion": {
"field": "jobs.suggest",
"size": 30
}
}
}
}
我的映射如下所示
"mappings": {
"jobs": {
"properties": {
"@timestamp": {
"type": "date"
},
"@version": {
"type": "text"
},
"industytype": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"jobs": {
"properties": {
"suggest": {
"type": "completion",
"analyzer": "simple",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
}
},
"language": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"type": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"updateddate": {
"type": "date"
}
}
}
}
}