您的位置 首页 elasticsearch

es mapping api

es mapping api

数据类型-IP案例
(1)创建索引时指定映射关系

PUT

http://10.0.0.111:19200/baimei-ip
{
    "mappings" :{
        "properties": {
            "ip_addr" : {
                "type": "ip"
            }
        }
    },
	"settings": {
		"number_of_shards":3,
		"number_of_replicas":0
	}
}

(2)查看索引的映射关系

GET

10.0.0.111:19200/baimei-ip

 

 

 

(3)

(3)创建测试数据
POST

10.0.0.111:19200/_bulk

 

{ "create": { "_index": "baimei-ip"} }
{ "ip_addr": "192.168.10.101" }
{ "create": { "_index": "baimei-ip"} }
{ "ip_addr": "192.168.10.201" }
{ "create": { "_index": "baimei-ip"} }
{ "ip_addr": "172.31.10.100" }
{ "create": { "_index": "baimei-ip"} }
{ "ip_addr": "10.0.0.222" }    

 

(4)查看IP的网段

GET/POST

10.0.0.111:19200/baimei-ip/_search

 

{
    "query": {
        "match" : {
            "ip_addr": "192.168.0.0/16"
        }
    }
}

欢迎来撩 : ELK集群汇总

欢迎来撩 : ansible汇总

欢迎来撩 : shell 编程从0到1

欢迎来撩 : devops cicd持续集成全程(汇总)

欢迎来撩 : 汇总all

 

欢迎来撩 : 汇总all

白眉大叔

关于白眉大叔linux云计算: 白眉大叔

热门文章