Created
February 19, 2013 18:38
-
-
Save plusjade/4988626 to your computer and use it in GitHub Desktop.
Elasticsearch curl example for ranking by individual token boosts. You can copy this full input and paste it directly into the command-line. Expected results: The result set should be sorted perfectly by the boost value for the skill "ruby". Please note term-frequencies WILL affect scoring and it's only because these documents have the exact sam…
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 characters
curl -XDELETE 'http://localhost:9200/p' | |
curl -XPOST 'http://localhost:9200/p' | |
curl -XPOST 'localhost:9200/p/profile/_mapping' -d ' | |
{ | |
"profile": { | |
"properties": { | |
"skills": { | |
"type": "string", | |
"omit_term_freq_and_positions" : true, | |
"index" : "not_analyzed" | |
} | |
} | |
} | |
}' | |
curl -XPOST localhost:9200/p/profile -d '{ | |
"skills": [ { "_value": "ruby", "_boost": 5 } ] | |
}' | |
curl -XPOST localhost:9200/p/profile -d '{ | |
"skills": [ { "_value": "ruby", "_boost": 4 } ] | |
}' | |
curl -XPOST localhost:9200/p/profile -d '{ | |
"skills": [ { "_value": "ruby", "_boost": 1 } ] | |
}' | |
curl -XPOST localhost:9200/p/profile -d '{ | |
"skills": [ { "_value": "ruby", "_boost": 3 } ] | |
}' | |
curl -XPOST localhost:9200/p/profile -d '{ | |
"skills": [ { "_value": "ruby", "_boost": 2 } ] | |
}' | |
curl -XPOST localhost:9200/p/profile -d '{ | |
"skills": [ { "_value": "python", "_boost": 100 } ] | |
}' | |
curl -XPOST "http://localhost:9200/p/_refresh" | |
curl -XGET 'localhost:9200/p/_search?&search_type=dfs_query_then_fetch&pretty=true' -d '{ | |
"query": { | |
"query_string": { | |
"query": "ruby" | |
} | |
}, | |
"sort": [{"_score": "desc"}], | |
"explain": false | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment