elasticsearch,Lucene,elasticsearch" /> elasticsearch,Lucene,elasticsearch" />

Lucene 在elasticsearch中更新现有文档

Lucene 在elasticsearch中更新现有文档,lucene,elasticsearch,Lucene,elasticsearch,是否可以在elasticsearch中向现有文档添加更多字段 例如,我为以下文档编制了索引: { "user":"xyz", "message":"for increase in fields" } curl -XGET 'http://localhost:9200/myindex/mytype/_search?q=user:xyz' 现在,我想再添加一个字段,即日期: { "user":"xyz", "message":"for increase in fi

是否可以在elasticsearch中向现有文档添加更多字段

例如,我为以下文档编制了索引:

{
    "user":"xyz",
    "message":"for increase in fields"
}
curl -XGET 'http://localhost:9200/myindex/mytype/_search?q=user:xyz'
现在,我想再添加一个字段,即日期:

{
    "user":"xyz",
    "message":"for increase in fields",
    "date":"2013-06-12"
}
如何进行此操作?

用于弹性搜索检查

更新API还支持传递部分文档(从0.20开始), 将合并到现有文档中(简单递归 合并、对象内部合并、替换核心“键/值”和 阵列)

Solr4.0还支持部分更新。选中

这可以通过以下方式完成(假设文档的ID为1):

然后查询文档:

{
    "user":"xyz",
    "message":"for increase in fields"
}
curl -XGET 'http://localhost:9200/myindex/mytype/_search?q=user:xyz'
您应该看到如下内容:

"_id":"1",
"_source:
    {
        {
            "user":"xyz",
            "message":"for increase in fields",
            "date":"2013-06-12"
        }
    }