Created
December 3, 2012 16:59
-
-
Save imotov/4196323 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 http://localhost:9200/test-idx | |
echo | |
curl -XPUT http://localhost:9200/test-idx -d '{ | |
"settings" : { | |
"index" : { | |
"number_of_shards" : 1, | |
"number_of_replicas" : 0 | |
} | |
}, | |
"mappings" : { | |
"rec" : { | |
"_source" : { "enabled" : false }, | |
"properties" : { | |
"color": { "type": "string", "store": "yes"} | |
} | |
} | |
} | |
}' | |
echo | |
curl -XPUT http://localhost:9200/test-idx/rec/1 -d '{ | |
"color": "red" | |
}' | |
echo | |
curl -XPUT http://localhost:9200/test-idx/rec/2 -d '{ | |
"color": "blue" | |
}' | |
echo | |
curl -XPUT http://localhost:9200/test-idx/rec/3 -d '{ | |
"color": "blue" | |
}' | |
echo | |
curl -XPOST http://localhost:9200/test-idx/_refresh | |
echo | |
curl -XGET 'http://localhost:9200/test-idx/rec/_search?pretty=true&search_type=count' -d '{ | |
"query": { | |
"query_string": { | |
"query": "*:*" | |
} | |
}, | |
"facets": { | |
"facet1": { | |
"script": { | |
"map_script": "facet[_fields[field].value] += 1", | |
"lang": "javascript", | |
"params" : { | |
"facet" : {}, | |
"field" : "color" | |
} | |
} | |
} | |
} | |
} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment