Skip to content

Instantly share code, notes, and snippets.

@s1monw
Created August 21, 2013 08:05
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 s1monw/6291595 to your computer and use it in GitHub Desktop.
Save s1monw/6291595 to your computer and use it in GitHub Desktop.
curl -XDELETE "http://localhost:9200/test?pretty"
curl -XPOST "http://localhost:9200/test?pretty" -d '{
"settings": {
"index": {
"number_of_shards" : 1,
"number_of_replicas" : 1
}
},
"mappings" : {
"participants" : {
"dynamic_templates" : [ {
"participants": {
"path_match": "*",
"mapping": {
"type": "string",
"store": "yes",
"index": "analyzed",
"analyzer": "whitespace"
}
}
}
]
}
}
}'
curl -XPOST "http://localhost:9200/test/participants?pretty=true&refresh=true" -d '{
"new": "foo-1",
"removed": ["bar-2", "bar-1", "bar 4"]
}'
echo ""
echo "###########################"
echo "find one result for 'foo-1'"
curl -XGET "http://localhost:9200/test/participants/_count?pretty" -d '{
"term": {
"new": {
"value": "foo-1"
}
}
}'
echo ""
echo "###########################"
echo "find nothing for 'foo'"
curl -XGET "http://localhost:9200/test/participants/_count?pretty" -d '{
"term": {
"new": {
"value": "foo"
}
}
}'
echo ""
echo "###########################"
echo "find one result for 'bar'"
curl -XGET "http://localhost:9200/test/participants/_count?pretty" -d '{
"term": {
"removed": {
"value": "bar"
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment