fair-search / fairsearch-fair-for-elasticsearch

Fair search elasticsearch plugin
Apache License 2.0
14 stars 3 forks source link

Fairsearch as an elasticsearch rescore function. #3

Closed purbon closed 6 years ago

purbon commented 6 years ago

The first and straight forward way to integrate the fair search methodology in an elasticsearch plugin is to offer the algorithm as a [rescore] function. (https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-request-rescore.html).

Given a query like this:

GET studies/_search
{
  "query": {
    "match": {
      "center": "Berlin"
    }
  },
  "rescore": {
    "window_size": 100,
    "fair_rescorer" : {
      "protected_key" : "gender",
      "protected_value" : "Female"
    }
  }
}

The system will execute the query

  "query": {
    "match": {
      "center": "Berlin"
    }

and then apply the rescore function to raise the score of top fair results.

This functionality will allow an initial, clean and straightforward implementation implementation that will provide initial high value to users of this plugin.

Depends On: #1

purbon commented 6 years ago

@tsuehr would you like to live test this with a real elasticsearch?

purbon commented 6 years ago

code has been tested and merge to master. closing for now, if you or we find bugs we should open new specific issues and fix them.