Skip to content

Instantly share code, notes, and snippets.

@imotov
Created April 9, 2013 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imotov/983383fd17b215c44c71 to your computer and use it in GitHub Desktop.
Save imotov/983383fd17b215c44c71 to your computer and use it in GitHub Desktop.
curl -XDELETE 'http://localhost:9200/test-idx'
echo
curl -XPUT 'http://localhost:9200/test-idx' -d '{
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0
},
"mappings": {
"doc": {
"properties": {
"stag": {
"type": "string"
},
"tag": {
"type": "string"
}
}
}
}
}
'
echo
curl -XPUT 'http://localhost:9200/test-idx/doc/1' -d '
{
"stag": "111",
"tag": ["xxx", "yyy"]
}
'
echo
curl -XPUT 'http://localhost:9200/test-idx/doc/2' -d '
{
"stag": "111",
"tag": ["zzz", "yyy"]
}
'
echo
curl -XPOST 'http://localhost:9200/test-idx/_refresh'
echo
curl -XGET 'http://localhost:9200/test-idx/doc/_search?pretty=true&search_type=count' -d '
{
"query" : {
"match_all" : { }
},
"facets": {
"facet1": {
"terms" : {
"script_field" : "_source.stag"
}
},
"facet2": {
"terms" : {
"script_field" : "_source.tag"
}
},
"facet3": {
"terms" : {
"field" : "tag"
}
}
}
}'
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment