Skip to content

Commit 2bb1210

Browse files
authored
Merge branch 'master' into development
2 parents a696226 + ba8ac44 commit 2bb1210

File tree

1 file changed

+92
-7
lines changed

1 file changed

+92
-7
lines changed

README.md

Lines changed: 92 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ Follow the standard plugin installation instructions, with a zip version of the
2424
"rescore": {
2525
"redis":{
2626
"key_field": "productId.keyword",
27-
"key_prefix": "mystore-",
28-
"score_operator": "MULTIPLY"
27+
"key_prefixes": ["mystore-","gympass-"],
28+
"score_weights": [0.5, 1.0],
29+
"score_operator": "ADD",
30+
"boost_operator": "ADD",
31+
"boost_weight": 1.0
2932
}
3033
}
3134
}
3235
```
33-
3436
In this example, we are expecting each hit to contain a field `productId` (of keyword type). The value of that field will be looked up in Redis as a key (for example, Redis key `mystore-abc123` will be looked-up for a document with productId abc123; the `mystore-` key prefix is configurable in query time).
3537
The `score_operator` field is the operator you want to be using when doing your final rescore, you can use `ADD`, `MULTIPLY`, or `SUBTRACT`.
3638

@@ -41,7 +43,92 @@ You can use `0` to demote results (e.g. mark as unavailable in stock), `1` to le
4143
<br/>
4244
<br/>
4345

44-
# Plugin Builder and Installation
46+
# Fields and how to use them
47+
48+
<br/>
49+
50+
## --> `key_prefixes` : str[]
51+
A list that contains the `key_prefixes` to use
52+
53+
<br/>
54+
55+
## --> `score_weights` : float[]
56+
A list that holds the weight value for each of the key_prefixes in the `key_prefixes` field.
57+
For example, in the **Usage** section, the `key_prefix` *"mystore-"* is beeing multiplied by **0.5** and the *"gympass-"* for **1**.
58+
59+
<br/>
60+
61+
## --> `boost_weight` : float
62+
Holds the weight value of the **elasticsearch_score**.
63+
For example, if the **elasticsearch_score** is **2** and the `boost_weight` **0.5** then the final **elasticsearch_score** will be **1**.
64+
65+
<br/>
66+
67+
## --> `score_operator` | `boost_operator` : str
68+
Can be:
69+
70+
- MULTiPLY
71+
- ADD
72+
- SET
73+
- SUBTRACT
74+
75+
The formula is:
76+
77+
**score** = *elasticsearch_score* (`boost_operator`) ( redis[`key_prefix[0]`+`key_field`] (`score_operator`) redis[`key_prefix[n-1]`+`key_field`])
78+
79+
80+
If `score_operator`: *"ADD"* **&** `boost_operator`: *"MULTIPLY"*,
81+
The formula will be:
82+
```
83+
score = elasticsearch_score * ( redis[mystore-20] + redis[gympass-20])
84+
```
85+
86+
<br/>
87+
<br/>
88+
89+
# Field Default Values
90+
The only field that is **required** for the plugin to run is the `key_field`, all the others can be `null`.
91+
## Default Values
92+
### `score_operator` | `boost_operator`
93+
***"ADD"***
94+
<br/>
95+
96+
### `scores_weight` | `boost_weight`
97+
***1***
98+
<br/>
99+
<br/>
100+
101+
# Plugin Installer
102+
<br/>
103+
104+
## 0- Dowload the plugin
105+
If you dont have the **.zip** of the compiled plugin you need to download it.
106+
You can download it in the [release page](https://github.com/sdrrv/elasticsearch-rescore-redis/releases).
107+
108+
<br/>
109+
110+
## 1- Install the Plugin
111+
Now you can `cd` into to the `bin` folder in your **ElasticSearch** instalation and run :
112+
```bash
113+
$ ./elasticsearch-plugin install file://dirOfYourPlugin
114+
```
115+
<br/>
116+
117+
## 2- Change the Redis host
118+
By default the plugin will think that your **Redis** server is running in the `localhost:6379` , that beeing said, you can change the `Host` but not the `Port`.
119+
The `Port` will always be `6379` because that's the default `Port` for the **Redis** server to run on.
120+
<br/>
121+
To change the `Host`, you first need to go to the `config` folder in your **ElasticSearch** dir.
122+
There open the `elasticsearch.yml` file, you want to add the following:
123+
124+
```YAML
125+
redisRescore.redisUrl : "YourHostIP"
126+
```
127+
128+
<br/>
129+
<br/>
130+
131+
# Plugin Builder
45132
46133
## 1- First pull the git rep into your machine
47134
<br/>
@@ -106,7 +193,5 @@ The `Port` will always be `6379` because that's the default `Port` for the **Red
106193
To change the `Host`, you first need to go to the `config` folder in your **ElasticSearch** dir.
107194
There open the `elasticsearch.yml` file, you want to add the following:
108195

109-
```YAML
110-
redisRescore.redisUrl : "YourHostIP"
111-
```
196+
112197

0 commit comments

Comments
 (0)