benashford / rs-es

A Rust client for the ElasticSearch REST API
Apache License 2.0
217 stars 44 forks source link

Add Filtered Functions #142

Open crocme10 opened 5 years ago

crocme10 commented 5 years ago

In a 'function_score', functions may have a filter and a weight. This commit wraps around the existing Function enum by creating a FilteredFunction struct, which contains both a function and a filter.

This is explained in the Elasticsearch documentation. Here is an example "function_score": { "query": { "match_all": {} }, "boost": "5", "functions": [ { "filter": { "match": { "test": "bar" } }, "random_score": {}, "weight": 23 }, { "filter": { "match": { "test": "cat" } }, "weight": 42 } ],