Asp.Net.Core log4net 写入Elasticsearch demo地址
github:https://github.com/foreverhot1019/AutoMapper_GZipTest
Elasticsearch REST APIs
ContentType:application/json
my_index:index名称
logType:索引类型
logId:自定义的文档Id
1.创建Index
put http://localhost:9200/my_index (无需put 任何数据)
2.上传文档
post http://localhost:9200/my_index/logType/logId (post json文档数据,logId不传:自动产生文档Id)
3.查看文档
get http://localhost:9200/my_index/logType/logId
get http://localhost:9200/my_index/logType/logId/_source (直接返回source)
4.修改文档
post http://localhost:9200/my_index/_update/logId
_update:不能变
内容 必须在 "doc" 节点后面 如:{ "doc": {"date":"2020/07/23 16:23:01"}}
只会更新部分数据
还可执行脚本 {"script": {"source": "if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }","lang": "painless","params": {"tag": "blue"}} }
参考:https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html