我将两个 PDF 文档的内容保存在 Elastic Search 中。方向是_source.attachment.content,我想做一个全文搜索。
现在,我的 Elastic Search 2 中有两个不同的 PDF,其中包含以下单词:“Overview”,而其他 PDF 则不包含此单词。
我像这样搜索它:
GET _search
{
"_source":[
"attachment.*",
"meta.*"
],
"query":{
"bool":{
"must":[
{
"multi_match":{
"query":"Over",
"fuzziness":2
}
},
{
"match":{
"meta.teamId":"specific id"
}
}
]
}
}
}
结果,我得到了两个文档之一,以及许多其他文档中没有子字符串“over”。如果我键入“overv”,则不会返回包含此子字符串的文档作为结果。如果我键入“概述”,那么我只会找到我想要的两个文档。
有什么我可以做得更好的吗?
先感谢您
编辑:命中看起来像:
{
"_index" : "docs",
"_type" : "_doc",
"_id" : "UO8RI28B94W61yv-lXqW",
"_score" : 16.099525,
"_source" : {
"attachment" : {
"date" : "2019-12-20T11:28:13Z",
"content_type" : "application/pdf",
"language" : "et",
"title" : "Microsoft Word - Dokument1",
"content" : """
Test PDF
2345
Etwas
Overview
""",
"content_length" : 42
},
"meta" : {
"teamId" : "specific id"
}
}
}
这是映射:
"mappings" : {
"properties" : {
"attachment" : {
"properties" : {
"content" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
},
"contentId" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
"meta" : {
"properties" : {
"teamId" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
},
"teamId" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
}