Skip to content

Instantly share code, notes, and snippets.

@anjesh
Created May 5, 2012 17:13
Show Gist options
  • Save anjesh/2604121 to your computer and use it in GitHub Desktop.
Save anjesh/2604121 to your computer and use it in GitHub Desktop.
Facet with phrases, allows counts for phrases with spaces
curl -XDELETE http://localhost:9200/testcompany/
curl -XPUT 'http://localhost:9200/testcompany/'
curl -XPUT 'http://localhost:9200/testcompany/activity1/_mapping' -d '{
"activity" : {
"properties" : {
"organization" : {"analyzer": "keyword", "type": "string"}
}
}
}'
curl -XPUT http://localhost:9200/testcompany/activity1/1 -d '{
"title": "title1 of project",
"organization": "ABC company"
}'
curl -XPUT http://localhost:9200/testcompany/activity1/2 -d '{
"title": "title2 of project",
"organization": "XYZ company"
}'
curl -XPUT http://localhost:9200/testcompany/activity1/3 -d '{
"title": "title3 of project",
"organization": "XYZ company"
}'
curl -X POST http://localhost:9200/testcompany/activity1/_search?pretty=true -d '{
"query" : {"match_all":{}},
"facets" : {"organization" : {"terms" : {"field": "organization"}}}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment