Skip to content

Instantly share code, notes, and snippets.

@ianAndrewClark
Created July 22, 2011 08:43
Show Gist options
  • Save ianAndrewClark/1099101 to your computer and use it in GitHub Desktop.
Save ianAndrewClark/1099101 to your computer and use it in GitHub Desktop.
multi-value term facet
curl -X DELETE "http://localhost:9200/classifieds"
echo -e "\ndeleted index"
curl -X POST "http://localhost:9200/classifieds/property/1" -d '{"type" : ["house", "detached"]}'
echo -e "\nindexed 1"
curl -X POST "http://localhost:9200/classifieds/property/2" -d '{"type" : ["house","detached"]}'
echo -e "\nindexed 2"
curl -X POST "http://localhost:9200/classifieds/property/3" -d '{"type" : ["house","semi"]}'
echo -e "\nindexed 3"
curl -X POST "http://localhost:9200/classifieds/property/4" -d '{"type" : ["house","terraced"]}'
echo -e "\nindexed 4"
curl -X POST "http://localhost:9200/classifieds/property/5" -d '{"type" : ["flat"]}'
echo -e "\nindexed 5"
curl -X POST "http://localhost:9200/classifieds/property/6" -d '{"type" : ["flat"]}'
echo -e "\nindexed 6"
curl -X POST "http://localhost:9200/classifieds/property/7" -d '{"type" : ["land", "farm"]}'
echo -e "\nindexed 7"
curl -X POST "http://localhost:9200/classifieds/property/8" -d '{"type" : ["land", "wood"]}'
echo -e "\nindexed 8"
curl -X POST "http://localhost:9200/classifieds/property/9?refresh=true" -d '{"type" : ["land", "wood"]}'
echo -e "\nindexed 9"
curl -X POST "http://localhost:9200/classifieds/_search?pretty=true" -d '
{
"size": 0,
"from": 0,
"query" : { "match_all" : { } },
"facets" : {
"tags" : { "terms" : {"field" : "type"}, "order" : "term" }
}
}
'
echo -e "\nsearched"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment