我只想突出我在查询中搜索的词,不包括同义词,但我也希望es可以返回搜索结果可以包含同义词搜索结果,这里是一个例子。
PUT /my_test_index/
{
"settings": {
"analysis": {
"filter": {
"native_synonym": {
"type": "synonym",
"ignore_case": true,
"expand": true,
"synonyms": [
"apple,fruit"
]
}
},
"analyzer": {
"test_analyzer": {
"tokenizer": "whitespace",
"filter": [
"native_synonym"
]
}
}
}
},
"mappings": {
"properties": {
"desc": {
"type": "text",
"analyzer": "test_analyzer"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
POST /my_test_index/_doc
{
"desc": "apple"
}
POST /my_test_index/_doc
{
"desc": "fruit"
}
Run Code Online (Sandbox Code Playgroud)
GET /my_test_index/_search
{
"query": {
"match": {
"desc": "apple"
}
},
"highlight": {
"fields": {
"desc": …Run Code Online (Sandbox Code Playgroud) 最近我想在本地文件 IO 上使用 Python async/await,但是我在阅读以下链接后发现这是不可能的:
解决方案是基于线程的 aiofiles 模块。但是在 Nodejs 中,只需使用基于标准 POSIX 函数的 fs 模块就可以使文件 IO 异步变得非常完美和容易。为什么当 nodejs 可以时,python 不能执行 I/O 异步?