Created
March 28, 2013 18:08
-
-
Save radu-gheorghe/5265495 to your computer and use it in GitHub Desktop.
Test for includes and excludes options of _source
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 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