插入后,文档会自动在Elasticsearch中删除

Sra*_*ra1 4 elasticsearch

我使用以下设置在Elasticsearch中创建了一个索引.使用Bulk API将数据插入索引后,docs.deleted计数不断增加.这是否意味着文档会自动被删除,如果是这样,我做错了什么?

PUT /inc_index/
{
  "mappings": {
    "store": {
      "properties": {
        "title": {
          "type": "string",
          "term_vector": "with_positions_offsets_payloads",
          "store" : true,
          "index_analyzer" : "fulltext_analyzer"
         },
         "description": {
          "type": "string",
          "term_vector": "with_positions_offsets_payloads",
          "store" : true,
          "index_analyzer" : "fulltext_analyzer"
        },
        "category": {
          "type": "string"
        }
      }
    }
  },
  "settings" : {
    "index" : {
      "number_of_shards" : 5,
      "number_of_replicas" : 1
    },
    "analysis": {
      "analyzer": {
        "fulltext_analyzer": {
          "type": "custom",
          "tokenizer": "whitespace",
          "filter": [
            "lowercase",
            "type_as_payload"
          ]
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

输出"GET /_cat/indices?v"如下图所示,"docs.deleted"不断增加:

health status index    pri rep docs.count docs.deleted store.size pri.store.size  
green  open   inc_index  5   1   2009877       584438      6.8gb          3.6gb
Run Code Online (Sandbox Code Playgroud)

And*_*fan 9

如果您的批量操作还包括对现有文档的更新(插入/更新具有相同ID的文档),那么这是正常的.在Elasticsearch中,更新是删除+插入操作的组合:https://www.elastic.co/guide/en/elasticsearch/guide/current/update-doc.html

您看到的已删除文档中有标记为已删除的文档.当Lucene段合并发生时,已删除的文档将从磁盘中物理删除.

  • 如果这种情况发生在不包含先前文档的新创建的索引上怎么办? (2认同)