Created
December 5, 2013 07:56
-
-
Save dadoonet/7801691 to your computer and use it in GitHub Desktop.
Facet on IP address V4
This file contains hidden or 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 -XPOST http://localhost:9200/foo; echo | |
curl -XPUT http://localhost:9200/foo/bar/_mapping -d '{ | |
"bar":{ | |
"properties":{ | |
"clientip":{ | |
"type":"multi_field", | |
"fields":{ | |
"clientip":{ | |
"type":"ip" | |
}, | |
"clientip_facet":{ | |
"type":"string", | |
"index":"not_analyzed" | |
} | |
} | |
} | |
} | |
} | |
}'; echo | |
curl -XPUT http://localhost:9200/foo/bar/1 -d '{"clientip":"192.168.0.1"}'; echo | |
curl -XPUT http://localhost:9200/foo/bar/2 -d '{"clientip":"192.168.0.2"}'; echo | |
curl -XPUT http://localhost:9200/foo/bar/3 -d '{"clientip":"192.168.0.3"}'; echo | |
curl -XPUT http://localhost:9200/foo/bar/4?refresh -d '{"clientip":"192.168.0.4"}'; echo | |
curl -XGET http://localhost:9200/foo/bar/_search?pretty -d '{ | |
"facets":{ | |
"pie":{ | |
"terms":{ | |
"field":"clientip", | |
"size":10 | |
} | |
} | |
} | |
}'; echo | |
curl -XGET http://localhost:9200/foo/bar/_search?pretty -d '{ | |
"facets":{ | |
"pie":{ | |
"terms":{ | |
"field":"clientip_facet", | |
"size":10 | |
} | |
} | |
} | |
}'; echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment