Mongodb文本搜索大集合 [英] Mongodb text search for large collection

查看:57
本文介绍了Mongodb文本搜索大集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出以下集合,该集合具有约 1800 万个文档的潜力.我需要文档的有效负载部分的搜索功能.由于数据量很大,如果我在文档中的有效负载字段上创建文本索引,是否会产生性能问题?当集合包含数百万个文档时,是否存在任何已知的性能问题?

Given below collection which has potential for ~18 million documents. I need a search functionality on the payload part of the document. Because of the large volume of data, will it create performance issues if I create a text index on the payload field in the document? Are there any known performance issues when the collection contains millions of documents?

{
    "_id" : ObjectId("5575e388e4b001976b5e570d"),
    "createdDate" : ISODate("2015-06-07T05:00:34.040Z"),
    "env" : "prod",
    "messageId" : "my-message-id-1",
    "payload" : "message payload typically 500-1000 bytes of string data"
}

我使用 MongoDB 3.0.3

I use MongoDB 3.0.3

推荐答案

您可以使用 Mongo DB Atlas 功能,在该功能中您可以根据 MongoDB 提供的不同分析器搜索您的文本.然后您可以进行模糊搜索,其中也将返回更接近您的文本的文本:PS:全文匹配和忽略模糊,只需要从下面排除模糊对象.

You can use the Mongo DB Atlas feature where you can search your text based on different Analyzers that MongoDB provides. And you can then do a fuzzy search where text closer to your text will also be returned: PS: For full-text match and to ignore fuzzy, just exclude the fuzzy object from below.

$search:{
 {
  index: 'analyzer_name_created_from_atlas_search',
  text: {
    query: 'message payload typically 500-1000 bytes of string data',
    path: 'payload',
    fuzzy:{
      maxEdits: 2
    }
  }
 }
}

这篇关于Mongodb文本搜索大集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆