Created
January 6, 2020 15:32
-
-
Save nik9000/055f5515cb35f71b9e5cdc0e09a52cd3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XDELETE -u elastic:password localhost:9200/test* | |
curl -HContent-Type:application/json -XPUT -u elastic:password localhost:9200/test_index-0001?pretty -d' | |
{ | |
"mappings": { | |
"properties": { | |
"ip": { | |
"type": "ip" | |
} | |
} | |
} | |
}' | |
curl -HContent-Type:application/json -XPUT -u elastic:password localhost:9200/test_index-0002?pretty -d' | |
{ | |
"mappings": { | |
"properties": { | |
"ip": { | |
"type": "ip" | |
} | |
} | |
} | |
}' | |
curl -HContent-Type:application/json -XPUT -u elastic:password localhost:9200/test_index-0001/_doc/1?pretty -d' | |
{ | |
"ip": "10.2.1.1" | |
}' | |
curl -HContent-Type:application/json -XPUT -u elastic:password localhost:9200/test_index-0002/_doc/1?pretty -d' | |
{ | |
"ip": "10.1.1.2" | |
}' | |
curl -HContent-Type:application/json -XPUT -u elastic:password localhost:9200/test_index-0003?pretty -d' | |
{ | |
"mappings": { | |
"properties": { | |
"somefield": { | |
"type": "ip" | |
} | |
} | |
} | |
}' | |
curl -XPOST -u elastic:password localhost:9200/_refresh | |
curl -HContent-Type:application/json -XPOST -u elastic:password 'localhost:9200/test_index-0001,test_index-0002,test_index*/_search?size=0&pretty' -d' | |
{ | |
"aggs": { | |
"composite_ips": { | |
"composite": { | |
"sources": [ | |
{ | |
"ip": { | |
"terms": { | |
"field": "ip" | |
} | |
} | |
} | |
] | |
} | |
}, | |
"term_ips": { | |
"terms": { | |
"field": "ip" | |
} | |
} | |
} | |
}' | |
curl -HContent-Type:application/json -XPUT -u elastic:password localhost:9200/test_index?pretty -d' | |
{ | |
"mappings": { | |
"properties": { | |
"somefield": { | |
"type": "ip" | |
} | |
} | |
} | |
}' | |
curl -HContent-Type:application/json -XPOST -u elastic:password 'localhost:9200/test_index-0001,test_index-0002,test_index*/_search?size=0&pretty' -d' | |
{ | |
"aggs": { | |
"term_ips": { | |
"terms": { | |
"field": "ip" | |
} | |
} | |
} | |
}' | |
curl -HDELETE -u elastic:password localhost:9200/test_index?pretty | |
curl -HContent-Type:application/json -XPOST -u elastic:password localhost:9200/test_index?pretty -d' | |
{ | |
"mappings": { | |
"properties": { | |
"ip": { | |
"type": "ip" | |
} | |
} | |
} | |
}' | |
curl -HContent-Type:application/json -XPOST -u elastic:password 'localhost:9200/test_index-0001,test_index-0002,test_index*/_search?size=0&pretty' -d' | |
{ | |
"aggs": { | |
"term_ips": { | |
"terms": { | |
"field": "ip" | |
} | |
} | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment