Created
November 29, 2011 02:54
-
-
Save redbeard/1403154 to your computer and use it in GitHub Desktop.
Demonstrates a potential bug in elasticsearch's 'store' and 'enabled' mapping options
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
#!/bin/bash | |
curl -XDELETE 'http://localhost:9200/documents/' | |
echo "" | |
curl -XPUT 'http://localhost:9200/documents' -d ' | |
{ | |
"mappings": { | |
"document" : { | |
"_source" : { "enabled" : true }, | |
"properties" : { | |
"content" : {"type" : "string", "store" : "yes"}, | |
"ignored_string" : {"type" : "string", "store" : "no", "index": "no" }, | |
"ignored_object" : {"type" : "object", "enabled": false, "store": "no", "index": "no" } | |
} | |
} | |
} | |
}' | |
echo "" | |
curl -X PUT "http://localhost:9200/documents/document/1" -d ' | |
{ | |
"content":"Hello world", | |
"ignored_string": "This should not be indexed or stored", | |
"ignored_object": { "description" : "This should not be indexed or stored" } | |
}' | |
echo "" | |
echo "Via get:" | |
curl -X GET "http://localhost:9200/documents/document/1" | |
echo "" | |
sleep 5 | |
echo "Via search:" | |
curl -X GET "http://localhost:9200/documents/_search" -d ' | |
{ | |
"query": | |
{ | |
"text": | |
{ "content": "Hello" } | |
} | |
} | |
' | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment