1、如何在Linux上建立ES nested 对象的mapping?
curl -XPUT '192.168.2.12:9203/cat' -d '
{
"mappings": {
"_default_": {
"properties": {
"hiturllist": {
"type": "nested",
"properties": {
"hiturl": { "type": "string" },
"collection_time": { "type": "long" }
}
},
"domain":{"type": "keyword"},
"texturl":{"type": "keyword"},
"textdomain":{"type": "keyword"},
"textfilepath":{"type": "keyword"},
"textfilename":{"type": "keyword"},
"collection_time":{"type":"long"}
}
}
}
}
注意:_default_字段是对所有的type都有效
2、put nested 数据
curl -XPUT 192.168.2.12:9203/cat/domain/5/_create -d '{
"hiturllist":[
{
"hiturl":"htttp://www.ok.com",
"collection_time":"20171202130050"
},
{
"hiturl":"htttp://www.lala.com",
"collection_time":"20171203130050"
}
],
"doamin":"192.168.1.2"
}'
其他的ES curl命令:
建立索引:curl -XPUT 'http://192.168.2.12:9203/2018-02-03'
删除索引:curl -XDELETE '192.168.2.10:9201/201802/'
查询:curl -XGET 192.168.2.12:9203/del/_search
获取mapping:curl -XGET 192.168.2.12:9203/2018-02-01/_mapping
网友评论