小编kon*_*yzt的帖子

如何禁用 es 突出显示同义词?

我只想突出我在查询中搜索的词,不包括同义词,但我也希望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)

java elasticsearch elk

5
推荐指数
1
解决办法
179
查看次数

为什么 Nodejs 可以异步执行文件 I/O 而 Python asyncio 不能?

最近我想在本地文件 IO 上使用 Python async/await,但是我在阅读以下链接后发现这是不可能的:

asyncio 是否支持文件操作的异步 I/O?

使用 asyncio 逐行读取文件

解决方案是基于线程的 aiofiles 模块。但是在 Nodejs 中,只需使用基于标准 POSIX 函数的 fs 模块就可以使文件 IO 异步变得非常完美和容易。为什么当 nodejs 可以时,python 不能执行 I/O 异步?

python asynchronous node.js

4
推荐指数
1
解决办法
1776
查看次数

标签 统计

asynchronous ×1

elasticsearch ×1

elk ×1

java ×1

node.js ×1

python ×1