Created
May 23, 2014 10:04
-
-
Save clintongormley/1da07e7576f38713e5c5 to your computer and use it in GitHub Desktop.
Revisions
-
clintongormley created this gist
May 23, 2014 .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,104 @@ DELETE /_all PUT /t { "mappings": { "test": { "properties": { "text": { "type": "string", "analyzer": "english", "fields": { "count": { "type": "token_count", "analyzer": "english" } } } } } } } PUT /t/test/1 { "text": "baseball bats" } GET /t/_analyze?field=text&text=baseball glove and hat GET /t/test/_search { "query": { "match": { "text": "baseball glove and hat" } }, "rescore": { "window_size": 1000, "query": { "score_mode": "multiply", "rescore_query": { "function_score": { "query": { "function_score": { "score_mode": "sum", "boost_mode": "replace", "functions": [ { "filter": { "match_all": {} }, "boost_factor": 0 }, { "filter": { "term": { "text": "basebal", "_cache": false } }, "boost_factor": 1 }, { "filter": { "term": { "text": "glove", "_cache": false } }, "boost_factor": 1 }, { "filter": { "term": { "text": "bat", "_cache": false } }, "boost_factor": 1 } ] } }, "boost_mode": "replace", "score_mode": "first", "functions": [ { "filter": { "match_all": {} }, "script_score": { "script": "return (_score < doc['text.count'].value) ? 0: 1" } } ] } } } } }