簡體   English   中英

帶有多個令牌的查詢上的ElasticSearch Querystring查詢通配符

[英]ElasticSearch Querystring Query Wildcard on query with multiple tokens

例如,我有一條內容為“ FileV2UpdateRequest”的記錄,根據我的分析器,它將把記錄分成令牌:

  • 文件
  • 2
  • 更新請求

我希望能夠在“ filev2update* ”查詢中搜索filev2update*來找到它,但是無論出於何種原因, *都不會像應有的那樣嘗試查找其余的“ updaterequest”。

如果輸入查詢filev2 update*它將返回結果。

在不需要空間的地方我能做些什么嗎?

我嘗試使用設置為true的auto_generate_phrase_queries設置,但這也無法解決問題。 看起來,當您添加通配符時,它會將整個輸入視為一個令牌,而不僅僅是查看通配符所接觸的令牌。

如果我添加了analyzer_wildcard並將其設置為true,它將嘗試在查詢中的每個標記上加上*。 costv * 2 *添加*

我認為您可以通過使用word_delimiter來索引內容來更改索引過濾器復合詞令牌過濾器

如果使用此過濾器

FileV2UpdateRequest將被分析為令牌:

{
    "tokens": [{
        "token": "File",
        "start_offset": 0,
        "end_offset": 4,
        "type": "word",
        "position": 1
    }, {
        "token": "V",
        "start_offset": 4,
        "end_offset": 5,
        "type": "word",
        "position": 2
    }, {
        "token": "2",
        "start_offset": 5,
        "end_offset": 6,
        "type": "word",
        "position": 3
    }, {
        "token": "Update",
        "start_offset": 6,
        "end_offset": 12,
        "type": "word",
        "position": 4
    }, {
        "token": "Request",
        "start_offset": 12,
        "end_offset": 19,
        "type": "word",
        "position": 5
    }]
}

對於搜索內容,還需要使用word_delimiter作為過濾器而不使用wild_card

filev2update將被分析為令牌:

{
    "tokens": [{
        "token": "file",
        "start_offset": 0,
        "end_offset": 4,
        "type": "word",
        "position": 1
    }, {
        "token": "V",
        "start_offset": 4,
        "end_offset": 5,
        "type": "word",
        "position": 2
    }, {
        "token": "2",
        "start_offset": 5,
        "end_offset": 6,
        "type": "word",
        "position": 3
    }, {
        "token": "update",
        "start_offset": 6,
        "end_offset": 12,
        "type": "word",
        "position": 4
    }]
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM