简体   繁体   English

ElasticSearch重新索引的原因

[英]ElasticSearch reindex reasons

I'm migrating to elasticSearch and wanna find out some questions. 我正在迁移到elasticSearch并想找出一些问题。 I am gonna use static + dynamic mapping (static type for fields, which I will use for filtering during the search, will not change their types in the future). 我将使用静态+动态映射(字段的静态类型,在搜索过程中将用于过滤,将来不会更改其类型)。 As I understand I can put different data to index and then change it. 据我了解,我可以将不同的数据放入索引,然后进行更改。 Example: 例:

{
  "name": "John",
  "secondName": "Smith",
  "age": 20,
  "params" : [
    {
      "a": "b",
      "c": "d"
    },
    {
      "m": "n"
    }
  ]
}

and then change this record to: 然后将此记录更改为:

{
  "name": "John",
  "secondName": "Smith",
  "age": "20",
  "newparams": [
    {
      "a": "b",
      "c": "d"
    },
    {
      "m": "n"
    }
  ]
}

So I can do it without reindexing. 因此,我无需重新编制索引就可以做到这一点。 I can change fields, can add new so what are the reasons, which force me to do reindex? 我可以更改字段,可以添加新字段,这是什么原因,迫使我重新编制索引?

Editing 编辑

The main goal is to use elastic instead of DB to enhance performance. 主要目标是使用弹性而不是DB来提高性能。 There will be storage and I will only retrieve info from it. 将有存储,我只会从中检索信息。 The search will depend on some fields with static mapping, I will no change their types. 搜索将取决于具有静态映射的某些字段,我不会更改其类型。 But in the future, I possible need to add some field or something like this, and I wanna know which my actions lead me to need to reindex? 但是将来,我可能需要添加一些字段或类似内容,并且我想知道哪些操作导致我需要重新编制索引?

Elasticsearch provides an reindex api which does this kind of things internally, take a look here . Elasticsearch提供了一个reindex api,该api在内部执行此类操作,请在此处查看 Alternative you can also update your documents with the update api. 或者,您也可以使用更新 API更新文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM