I created a percolation index with a custom similarity in its settings and a mapping to use this custom similarity:
{
"my-index": {
"settings": {
"index": {
"similarity": {
"idfless": {
"type": "scripted",
"script": {
"source": "double tf = Math.sqrt(doc.freq); double idf = 1.0; double norm = 1/Math.sqrt(doc.length); return query.boost * tf * idf * norm;"
}
}
}
}
},
"mappings": {
"my-doc-type": {
"message": {
"type": "text",
"similarity": "idfless"
},
"query": {
"type": "percolator"
}
}
}
However, this similarity setting is not respected. If I run a query and ask it to be explained like:
POST my-index/search/0/_explain
{
"query": {
percolate" : {
"field" : "query",
"documents" : [
{
"message": ...
},
{
"message": ...
}
]
}
}
}
However, result obtained is like this:
{
"value": 0.6931472,
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details": [
{
"value": 1,
"description": "docFreq",
"details": []
},
{
"value": 2,
"description": "docCount",
"details": []
}
]
}
Is there something wrong that I'm doing in order to get my percolator to use the specified similarity? Similar question has been posted in https://discuss.elastic.co/t/custom-similarity-not-respected-in-percolate-query/239541, however it is not answered yet.