小编m_c*_*m_c的帖子

字段中的点不用于分解分析器的单词

我有以下索引文档映射(简化)

{
    "documents": {
        "mappings": {
            "document": {
                "properties": {
                    "filename": {
                        "type": "string",
                        "fields": {
                            "lower_case_sort": {
                                "type": "string",
                                "analyzer": "case_insensitive_sort"
                            },
                            "raw": {
                                "type": "string",
                                "index": "not_analyzed"
                            }
                        }
                    }
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我将两个文档放入该索引

{
    "_index": "documents",
    "_type": "document",
    "_id": "777",
    "_source": {
        "filename": "text.txt",
    }
}
Run Code Online (Sandbox Code Playgroud)

...

{
    "_index": "documents",
    "_type": "document",
    "_id": "888",
    "_source": {
        "filename": "text 123.txt",
    }
}
Run Code Online (Sandbox Code Playgroud)

对“文本”进行 query_string 或 simple_query_string 查询我希望能返回两个文档。它们应该匹配,因为文件名是“text.txt”和“text 123.txt”。

http://localhost:9200/defiant/_search?q=text
Run Code Online (Sandbox Code Playgroud)

但是,我只找到名称为“test 123.txt”的文档 - 仅当我搜索“test.*”或“test.txt”或“test.???”时才能找到“test.txt” - 我必须在文件名中添加点。

这是我针对文档 …

elasticsearch

3
推荐指数
1
解决办法
1730
查看次数

标签 统计

elasticsearch ×1