Skip to content

Instantly share code, notes, and snippets.

@radu-gheorghe
Created October 30, 2012 15:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radu-gheorghe/3980928 to your computer and use it in GitHub Desktop.
Save radu-gheorghe/3980928 to your computer and use it in GitHub Desktop.
Elasticsearch - include in _all with index=no
echo ===Removing everything===
curl -XDELETE localhost:9200/test
echo
echo ===Putting empty index===
curl -XPUT localhost:9200/test
echo
echo ====Putting mapping===
curl -XPUT localhost:9200/test/test/_mapping -d '{
"test": {
"properties": {
"foo": {
"type": "string",
"index": "no",
"include_in_all": true
}
}
}
}'
echo
echo ===Indexing sample doc===
curl -XPOST localhost:9200/test/test/ -d '{"foo":"bar"}'
echo
#sleep 1
echo ===Refreshing===
curl -XPOST localhost:9200/test/_refresh
echo
echo "===Search in foo=="
curl -XPOST localhost:9200/test/test/_search?pretty=true -d '{
"query": {
"term": {
"foo": "bar"
}
}
}'
echo
echo "===Search in _all=="
curl -XPOST localhost:9200/test/test/_search?pretty=true -d '{
"query": {
"term": {
"_all": "bar"
}
}
}'
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment