Created
January 26, 2012 00:45
-
-
Save lukas-vlcek/1680067 to your computer and use it in GitHub Desktop.
Phrase search (out of the box 0.18.7)
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/sh | |
curl -X DELETE 'localhost:9200/i/t' | |
curl -X PUT 'localhost:9200/i/t/1' -d '{"f":"Lorem ipsum Robert E. Anderson dolor sit amet."}' | |
curl -X PUT 'localhost:9200/i/t/2' -d '{"f":"Lorem ipsum Robert Johnson."}' | |
curl -X POST 'localhost:9200/_refresh' | |
echo "\n\nSearch for \"Robert Johnson\"\n" | |
curl -X GET 'localhost:9200/_search?pretty=true' -d '{"fields":["f"],"query":{"query_string":{"query":"\"Robert Johnson\""}}}' | |
echo "\n\nSearch for \"Robert E. Anderson\"\n" | |
curl -X GET 'localhost:9200/_search?pretty=true' -d '{"fields":["f"],"query":{"query_string":{"query":"\"Robert E. Anderson\""}}}' | |
----- output ----- | |
Search for "Robert Johnson" | |
{ | |
"took" : 6, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 1, | |
"max_score" : 0.30685282, | |
"hits" : [ { | |
"_index" : "i", | |
"_type" : "t", | |
"_id" : "2", | |
"_score" : 0.30685282, | |
"fields" : { | |
"f" : "Lorem ipsum Robert Johnson." | |
} | |
} ] | |
} | |
} | |
Search for "Robert E. Anderson" | |
{ | |
"took" : 5, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 1, | |
"max_score" : 0.28767452, | |
"hits" : [ { | |
"_index" : "i", | |
"_type" : "t", | |
"_id" : "1", | |
"_score" : 0.28767452, | |
"fields" : { | |
"f" : "Lorem ipsum Robert E. Anderson dolor sit amet." | |
} | |
} ] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment