首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >弹性搜索全文搜索

弹性搜索全文搜索
EN

Stack Overflow用户
提问于 2020-01-27 19:12:34
回答 1查看 125关注 0票数 1

我将两个PDF文档的内容保存在Elastic Search中。方向是_source.attachment.content,我想进行全文搜索。

现在我有两个不同的PDF在我的Elastic Search 2,其中包含单词:“概述”和其他没有这个单词。

我像这样搜索它:

代码语言:javascript
复制
GET _search
{ 
   "_source":[ 
      "attachment.*",
      "meta.*"
   ],
   "query":{ 
      "bool":{ 
         "must":[ 
            { 
               "multi_match":{ 
                  "query":"Over",
                  "fuzziness":2
               }
            },
            { 
               "match":{ 
                  "meta.teamId":"specific id"
               }
            }
         ]
      }
   }
}

结果,我得到了两个文档中的一个,以及其中没有子字符串"over“的许多其他文档。如果我输入"overv“,则不会返回包含此子字符串的文档作为结果。如果我输入"overview“,那么我只找到我想要的两个文档。

有什么我可以做得更好的吗?

提前谢谢你

编辑:点击率如下:

代码语言:javascript
复制
{
        "_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"
          }
        }
      }

下面是映射:

代码语言:javascript
复制
"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
        }
      }
    }
  }
}
EN

回答 1

Stack Overflow用户

发布于 2020-01-27 19:20:22

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59929991

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档