赞
踩
DELETE /demo_test PUT /demo_test { "settings": { "number_of_shards": 1, "number_of_replicas": "0" }, "mappings": { "properties": { "type": { "type": "keyword" }, "name": { "type": "keyword" }, "ip": { "type": "ip" }, "vname": { "type": "keyword" }, "list": { "type": "nested", "properties": { "id": { "type": "integer" }, "type": { "type": "keyword" }, "name": { "type": "keyword" } } }, "GatewayAddress": { "type": "nested", "properties": { "ip": { "type": "ip" }, "mask": { "type": "short" } } }, "ips": { "type": "ip" }, , "time": { "type": "date", "format":"yyyy-MM-dd HH:mm:ss" } } } } POST demo_test/_doc {"type":"type01", "name":"name01", "ip":"172.1.1.200", "vname":"vname", "list": [ { "id":1, "type":"xx", "name":"XXX" } ], "GatewayAddress":[ { "ip":"10.0.1.1", "mask":32 }, { "ip":"0.0.0.0", "mask":24 } ], "ips":["192.168.3.120", "192.168.3.121", "192.168.3.121", "192.168.3.121"], "time":"2020-04-17 18:04:30" } 联查: GET demo_test/_search { "query": { "bool": { "must": [ { "query_string": { "query": "xxx", "default_field": "name" } }, { "nested": { "path": "list", "query": { "term": { "list.id": { "value": 1 } } } } }, { "query_string": { "query": "vname01", "default_field": "vname" } }, { "nested": { "path": "GatewayAddress", "query": { "term": { "GatewayAddress.ip": { "value": "0.0.0.0" } } } } }, { "term": { "ips":{ "value": "0.0.0.0" } } } ] } } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。