MongoDB + Elasticsearch 还是只有 Elasticsearch? [英] MongoDB + Elasticsearch or only Elasticsearch?

查看:12
本文介绍了MongoDB + Elasticsearch 还是只有 Elasticsearch?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在那里有一个新项目,用于索引大量数据并提供实时数据.我还使用方面、全文、地理空间进行了复杂的搜索...

We have a new project there for index a large amount of data and for provide real time. I have also complexe search with facets, full text, geospatial...

第一个原型是在 MongoDB 中建立索引,然后在 Elasticsearch 中建立索引,因为我读过 Elasticsearch 不会对存储的文件应用校验和,并且不能完全信任索引.但是自从上一个版本(在 1.5 版中)以来,现在有一个校验和,我猜我们是否可以使用 Elasticsearch 作为主要数据存储?除了 Elasticsearch 之外,使用 MongoDB 有什么好处?

The first prototype is to index in MongoDB and next, into Elasticsearch, because I had read that Elasticsearch does not apply a checksum on stored files and the index can't be fully trusted. But since last versions (in the version 1.5), there is now a checksum and I'm guessing if we can use Elasticsearch as primary data store ? And what is the benefit to use MongoDB in addition to Elasticsearch ?

我在 Elasticsearch 中找不到关于这些功能的最新答案

I can't find up to date answer about thoses features in Elasticsearch

非常感谢

推荐答案

谈论参数使用 Mongo 代替/与 ES 一起使用:

Talking about arguments to use Mongo instead of/together with ES:

  1. 用户/角色管理.

  1. User/role management.

  • 内置于 MongoDB.可能无法满足您的所有需求,可能在某处有些笨拙,但它确实存在,并且在很久以前就已实施.
  • ES 中唯一的安全性就是 shield.但它仅提供用于生产用途的 Gold/Platinum 订阅.

架构

  • ES 是无模式的,但它建立在 Lucene 之上并用 Java 编写.这个工具的核心思想——索引和搜索文档,并且以这种方式工作需要索引的一致性.在后端,所有文档都应该安装在平面 lucene 索引中,这需要了解 ES 应该如何处理嵌套文档和值,以及如何组织索引以保持速度和速度之间的平衡.数据完整性/一致性.使用 ES 需要您始终牢记有关模式的一些事情.即:因为您可以在不预先放置相应映射的情况下将几乎任何东西索引到 ES,ES 可以动态猜测"映射但有时会做错,有时隐式映射是邪恶的,因为一旦放置,它就无法更改 w/o 重新索引整个索引.因此,最好不要将 ES 视为无模式存储,因为您可以在一段时间内踩到耙子(这将是 pain :)),而是将其视为模式密集型,至少在您使用的文档可以被分割成具体的字段.
  • 另一方面,Mongo 几乎可以从您放入其中的任何东西中咀嚼并且不留下任何碎屑".并且大多数查询都可以正常工作,直到您记得 Mongo 将如何从 JavaScript 角度处理您的数据.由于 JS 是弱类型的,您可以使用真正无模式的工作流程(当然,如果您需要的话)
  • ES is schemaless, but its built on top of Lucene and written in Java. The core idea of this tool - index and search documents, and working this way requires index consistency. At back end, all documents should be fitted in flat lucene index, which requires some understanding about how ES should deal with your nested documents and values, and how you should organize your indexes to maintain balance between speed and data completeness/consistency. Working with ES requires you to keep some things about schema in mind constantly. I.e: as you can index almost anything to ES without putting corresponding mapping in advance, ES can "guess" mapping on the fly but sometimes do it wrong and sometimes implicit mapping is evil, because once it put, it can't be changed w/o reindexing whole index. So, its better to not treat ES as schemaless store, because you can step on a rake some time (and this will be pain :) ), but rather treat it as schema-intensive, at least when you work with documents, that can be sliced to concrete fields.
  • Mongo, on the other hand, can "chew and leave no crumbs" out of almost anything you put in it. And most your queries will work fine, `til you remember how Mongo will deal with your data from JavaScript perspective. And as JS is weakly typed, you can work with really schemaless workflow (for sure, if you need such)

处理非表格数据.

  • ES 仅限于处理数据而不将其放入搜索索引.当您需要存储和检索一些额外数据(与您要搜索的数据相比)时,这个解决方案已经足够好了.
  • MongoDB 支持 gridFS.这使您能够在同一接口后面处理大量数据.即,您可以在 Mongo 中存储二进制数据,并从代码的角度在同一界面中检索它.

这篇关于MongoDB + Elasticsearch 还是只有 Elasticsearch?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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