Skip to content

Instantly share code, notes, and snippets.

@radu-gheorghe
Created March 28, 2013 18:08
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 radu-gheorghe/5265495 to your computer and use it in GitHub Desktop.
Save radu-gheorghe/5265495 to your computer and use it in GitHub Desktop.
Test for includes and excludes options of _source
curl -XDELETE localhost:9200/test1/
curl -XDELETE localhost:9200/test2/
curl -XPUT localhost:9200/test1/
curl -XPUT localhost:9200/test1/source_includes/_mapping -d '{
"source_includes": {
"_source": {
"includes": [ "included" ]
}
}
}'
curl -XPUT localhost:9200/test1/source_includes/1 -d '{
"included": "foo",
"excluded": "bar"
}'
echo
echo "========="
echo "Only 'included' field should be shown"
echo "========="
curl -XGET localhost:9200/test1/source_includes/1?fields=_source,included,excluded
echo
curl -XPUT localhost:9200/test2/
curl -XPUT localhost:9200/test2/source_excludes/_mapping -d '{
"source_excludes": {
"_source": {
"excludes": [ "excluded" ]
}
}
}'
curl -XPUT localhost:9200/test2/source_excludes/1 -d '{
"included": "foo",
"excluded": "bar"
}'
echo
echo "========="
echo "Only 'included' field should be shown"
echo "========="
curl -XGET localhost:9200/test2/source_excludes/1?fields=_source,included,excluded
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment