Skip to content

Instantly share code, notes, and snippets.

@s1monw s1monw/gist:6291595
Created Aug 21, 2013

Embed
What would you like to do?
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
You can’t perform that action at this time.