# Index some test datacurl -XPUT "localhost:9200/test/doc/1" -d '{"title": "one"}'curl -XPUT "localhost:9200/test/doc/2" -d '{"title": "two"}'curl -XPUT "localhost:9200/test/doc/3" -d '{"title": "three"}'curl -XPUT "localhost:9200/test/doc/4" -d '{"title": "one two"}'curl -XPUT "localhost:9200/test/doc/5" -d '{"title": "one three"}'curl -XPUT "localhost:9200/test/doc/6" -d '{"title": "one two three"}'curl -XPUT "localhost:9200/test/doc/7" -d '{"title": "two three"}'curl -XPUT "localhost:9200/test/doc/8" -d '{"title": "none"}'curl -XPUT "localhost:9200/test/doc/9" -d '{"title": "one abc"}'curl -XPUT "localhost:9200/test/doc/10" -d '{"title": "two abc"}'curl -XPUT "localhost:9200/test/doc/11" -d '{"title": "three abc"}'curl -XPUT "localhost:9200/test/doc/12" -d '{"title": "one two abc"}'curl -XPUT "localhost:9200/test/doc/13" -d '{"title": "one two three abc"}'curl -XPUT "localhost:9200/test/doc/14" -d '{"title": "two three abc"}'# Make test data available for searchcurl -XPOST "localhost:9200/test/_refresh?pretty"# Search using function scorecurl -XPOST "localhost:9200/test/doc/_search?pretty" -d'{ "query": { "function_score": { "query": { "match": { "title": "one two three" } }, "functions": [ { "filter": { "query": { "match": { "title": "one" } } }, "weight": 1 }, { "filter": { "query": { "match": { "title": "two" } } }, "weight": 2 }, { "filter": { "query": { "match": { "title": "three" } } }, "weight": 3 } ], "score_mode": "sum", "boost_mode": "replace" } }, "sort": [ { "_score": { "order": "desc" } } ], "from": "0", "size": "100"}'