Created
October 30, 2012 15:27
-
-
Save radu-gheorghe/3980928 to your computer and use it in GitHub Desktop.
Elasticsearch - include in _all with index=no
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
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