Created
August 21, 2013 08:05
-
-
Save s1monw/6291595 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?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