我将两个PDF文档的内容保存在Elastic Search中。方向是_source.attachment.content,我想进行全文搜索。
现在我有两个不同的PDF在我的Elastic Search 2,其中包含单词:“概述”和其他没有这个单词。
我像这样搜索它:
GET _search
{
"_source":[
"attachment.*",
"meta.*"
],
"query":{
"bool":{
"must":[
{
"multi_match":{
"query":"Over",
"fuzziness":2
}
},
{
"match":{
"meta.teamId":"specific id"
}
}
]
}
}
}结果,我得到了两个文档中的一个,以及其中没有子字符串"over“的许多其他文档。如果我输入"overv“,则不会返回包含此子字符串的文档作为结果。如果我输入"overview“,那么我只找到我想要的两个文档。
有什么我可以做得更好的吗?
提前谢谢你
编辑:点击率如下:
{
"_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
}
}
}
}
}发布于 2020-01-27 19:20:22
https://stackoverflow.com/questions/59929991
复制相似问题