Created
June 1, 2012 18:05
-
-
Save zibarth/2854076 to your computer and use it in GitHub Desktop.
ElsaticSearch mapping and documents demonstrating the WAS problem
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
#Create index | |
curl -XPUT localhost:9200/test -d ' | |
{ | |
"test" : { | |
"test" : { | |
"properties" : { | |
"tripFrom" : {"type" : "string"}, | |
"tripTo":{"type":"string"} | |
} | |
} | |
} | |
} | |
' | |
#Insert first document | |
curl -XPUT localhost:9200/test/test/1 -d ' | |
{ | |
"tripFrom" : "WAS", | |
"tripTo" : "NYC" | |
} | |
' | |
#Insert second document | |
curl -XPUT localhost:9200/test/test/2 -d ' | |
{ | |
"tripFrom" : "NYC", | |
"tripTo" : "CHI" | |
} | |
' | |
#Search for tripFrom=NYC. ES returns the 2nd document. | |
curl -XGET localhost:9200/test/_search -d ' | |
{ | |
"query" : { | |
"query_string" : { | |
"default_field" : "tripFrom", | |
"query" : "NYC" | |
} | |
} | |
} | |
' | |
#Search for tripFrom=WAS. ES should find the 1st document, but instead there are NO results. | |
curl -XGET localhost:9200/test/_search -d ' | |
{ | |
"query" : { | |
"query_string" : { | |
"default_field" : "tripFrom", | |
"query" : "WAS" | |
} | |
} | |
} | |
' | |
#Search for tripTo=NYC. ES now returns the 1st document. | |
curl -XGET localhost:9200/test/_search -d ' | |
{ | |
"query" : { | |
"query_string" : { | |
"default_field" : "tripTo", | |
"query" : "NYC" | |
} | |
} | |
} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment