Last active
December 21, 2015 14:09
Revisions
-
darklow revised this gist
Aug 23, 2013 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -68,5 +68,7 @@ curl -X POST "http://localhost:9200/hotels/_suggest?pretty=true" -d ' echo # Found using first letters of first words - M, C or G # Can't find using Mu, Mun, Munich, City, General, so on # anyone know why? # Thank you -
darklow created this gist
Aug 23, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,72 @@ #!/bin/bash # ======================================== # Testing completion suggest in ElasticSearch # ======================================== curl -X DELETE localhost:9200/hotels curl -X PUT localhost:9200/hotels -d ' { "mappings": { "hotel" : { "properties" : { "name" : { "type" : "string" }, "city" : { "type" : "string" }, "name_suggest" : { "type" : "completion", "payloads" : true } } } } }' curl -X PUT localhost:9200/hotels/hotel/3 -d ' { "name" : "Courtyard by Marriot Munich City", "city" : "Munich", "name_suggest" : { "input" : [ "Courtyard by Marriot Munich City", "Marriot Munich City", "General Munich Hotel" ], "output": "Hotel Marriot", "weight": 15, "payload": { "hotel_id": 3} } }' curl -X POST "http://localhost:9200/hotels/_refresh" # Some debug info echo echo "name_suggest input: { \"Courtyard by Marriot Munich City\", \"Marriot Munich City\", \"General Munich Hotel\" }" echo echo "# Found using first letters of first words - M, C or G" curl -X POST "http://localhost:9200/hotels/_suggest?pretty=true" -d ' { "hotels": { "text": "M", "completion": { "field": "name_suggest" } } }' echo echo "# Can't find using Mu, Mun, Munich, City, General, so on" curl -X POST "http://localhost:9200/hotels/_suggest?pretty=true" -d ' { "hotels": { "text": "Munich", "completion": { "field": "name_suggest" } } }' echo # anyone know why? Thank you