ElasticSearch更新Api不会增加docs.deleted计数

时间:2015-02-04 18:59:19

标签: api elasticsearch

我创建了一个名为" second" ,

health status index  pri rep docs.count docs.deleted store.size pri.store.size 
yellow open   second   5   1          2            0      5.5kb          5.5kb 
yellow open   first    5   1          2            0      5.3kb          5.3kb 

我有两个文件,我创建了一个这样的新文档。

curl -X PUT  http://localhost:9200/second/obj/3 -d '{"name": "abc","age":"25"}'

我通过使用post方法调用相同的Api来更新文档

curl -X POST  http://localhost:9200/second/obj/3 -d '{"name": "xyz","age":"25"}'

它已成功更新

{"_index":"second","_type":"obj","_id":"3","_version":2,"created":false}

但现在我看到curl http://localhost:9200/_cat/indices?v

它给我输出

health status index  pri rep docs.count docs.deleted store.size pri.store.size 
yellow open   second   5   1          3            0     10.6kb         10.6kb 
yellow open   first    5   1          2            0      5.3kb          5.3kb

它应该增加" docs.deleted"算了,为什么它没有增加?

编辑:正如要求附加api调用的输出

我跑的时候

curl 'http://localhost:9200/second/_segments?pretty'

{
  "_shards" : {
    "total" : 10,
    "successful" : 5,
    "failed" : 0
  },
  "indices" : {
    "second" : {
      "shards" : {
        "0" : [ {
          "routing" : {
            "state" : "STARTED",
            "primary" : true,
            "node" : "V43oOKhBTCOLLDZ0IMRi8g"
          },
          "num_committed_segments" : 1,
          "num_search_segments" : 1,
          "segments" : {
            "_0" : {
              "generation" : 0,
              "num_docs" : 1,
              "deleted_docs" : 0,
              "size_in_bytes" : 2535,
              "memory_in_bytes" : 6898,
              "committed" : true,
              "search" : true,
              "version" : "4.10.2",
              "compound" : true
            }
          }
        } ],
        "1" : [ {
          "routing" : {
            "state" : "STARTED",
            "primary" : true,
            "node" : "V43oOKhBTCOLLDZ0IMRi8g"
          },
          "num_committed_segments" : 1,
          "num_search_segments" : 1,
          "segments" : {
            "_0" : {
              "generation" : 0,
              "num_docs" : 1,
              "deleted_docs" : 0,
              "size_in_bytes" : 2535,
              "memory_in_bytes" : 6898,
              "committed" : true,
              "search" : true,
              "version" : "4.10.2",
              "compound" : true
            }
          }
        } ],
        "2" : [ {
          "routing" : {
            "state" : "STARTED",
            "primary" : true,
            "node" : "V43oOKhBTCOLLDZ0IMRi8g"
          },
          "num_committed_segments" : 1,
          "num_search_segments" : 2,
          "segments" : {
            "_3" : {
              "generation" : 3,
              "num_docs" : 1,
              "deleted_docs" : 0,
              "size_in_bytes" : 2547,
              "memory_in_bytes" : 6898,
              "committed" : true,
              "search" : true,
              "version" : "4.10.2",
              "compound" : true
            },
            "_4" : {
              "generation" : 4,
              "num_docs" : 1,
              "deleted_docs" : 0,
              "size_in_bytes" : 2535,
              "memory_in_bytes" : 6898,
              "committed" : false,
              "search" : true,
              "version" : "4.10.2",
              "compound" : true
            }
          }
        } ],
        "3" : [ {
          "routing" : {
            "state" : "STARTED",
            "primary" : true,
            "node" : "V43oOKhBTCOLLDZ0IMRi8g"
          },
          "num_committed_segments" : 1,
          "num_search_segments" : 2,
          "segments" : {
            "_0" : {
              "generation" : 0,
              "num_docs" : 1,
              "deleted_docs" : 0,
              "size_in_bytes" : 2547,
              "memory_in_bytes" : 6898,
              "committed" : true,
              "search" : true,
              "version" : "4.10.2",
              "compound" : true
            },
            "_1" : {
              "generation" : 1,
              "num_docs" : 1,
              "deleted_docs" : 0,
              "size_in_bytes" : 2535,
              "memory_in_bytes" : 6898,
              "committed" : false,
              "search" : true,
              "version" : "4.10.2",
              "compound" : true
            }
          }
        } ],
        "4" : [ {
          "routing" : {
            "state" : "STARTED",
            "primary" : true,
            "node" : "V43oOKhBTCOLLDZ0IMRi8g"
          },
          "num_committed_segments" : 1,
          "num_search_segments" : 1,
          "segments" : {
            "_0" : {
              "generation" : 0,
              "num_docs" : 1,
              "deleted_docs" : 0,
              "size_in_bytes" : 2535,
              "memory_in_bytes" : 0,
              "committed" : true,
              "search" : false,
              "version" : "4.10.2",
              "compound" : true
            },
            "_2" : {
              "generation" : 2,
              "num_docs" : 1,
              "deleted_docs" : 0,
              "size_in_bytes" : 2748,
              "memory_in_bytes" : 7818,
              "committed" : false,
              "search" : true,
              "version" : "4.10.2",
              "compound" : true
            }
          }
        } ]
      }
    }
  }
}

对于第一个索引:

{
  "_shards" : {
    "total" : 10,
    "successful" : 5,
    "failed" : 0
  },
  "indices" : {
    "first" : {
      "shards" : {
        "0" : [ {
          "routing" : {
            "state" : "STARTED",
            "primary" : true,
            "node" : "V43oOKhBTCOLLDZ0IMRi8g"
          },
          "num_committed_segments" : 0,
          "num_search_segments" : 0,
          "segments" : { }
        } ],
        "1" : [ {
          "routing" : {
            "state" : "STARTED",
            "primary" : true,
            "node" : "V43oOKhBTCOLLDZ0IMRi8g"
          },
          "num_committed_segments" : 0,
          "num_search_segments" : 0,
          "segments" : { }
        } ],
        "2" : [ {
          "routing" : {
            "state" : "STARTED",
            "primary" : true,
            "node" : "V43oOKhBTCOLLDZ0IMRi8g"
          },
          "num_committed_segments" : 1,
          "num_search_segments" : 1,
          "segments" : {
            "_3" : {
              "generation" : 3,
              "num_docs" : 1,
              "deleted_docs" : 0,
              "size_in_bytes" : 2392,
              "memory_in_bytes" : 5978,
              "committed" : true,
              "search" : true,
              "version" : "4.10.2",
              "compound" : true
            }
          }
        } ],
        "3" : [ {
          "routing" : {
            "state" : "STARTED",
            "primary" : true,
            "node" : "V43oOKhBTCOLLDZ0IMRi8g"
          },
          "num_committed_segments" : 1,
          "num_search_segments" : 1,
          "segments" : {
            "_0" : {
              "generation" : 0,
              "num_docs" : 1,
              "deleted_docs" : 0,
              "size_in_bytes" : 2391,
              "memory_in_bytes" : 5978,
              "committed" : true,
              "search" : true,
              "version" : "4.10.2",
              "compound" : true
            }
          }
        } ],
        "4" : [ {
          "routing" : {
            "state" : "STARTED",
            "primary" : true,
            "node" : "V43oOKhBTCOLLDZ0IMRi8g"
          },
          "num_committed_segments" : 0,
          "num_search_segments" : 0,
          "segments" : { }
        } ]
      }
    }
  }
}

0 个答案:

没有答案