- I want to use
search_analyzer
while disabling normalization factors. - I'm using elasticsearch:7.6.2
I configured my index:
"settings": {
"analysis": {
"analyzer": {
"my_analyzer": {
"type": "custom",
"tokenizer": "standard",
"norms": "false",
}
}
}
},
"mappings": {
"properties": {
"content": {"type": "text",
"search_analyzer": "my_analyzer",
"analyzer": "standard"},
}
}
but is seems that it is using the normalization factors in searching time.
I have 3 documents in my index:
- michael jordan and scottie pippen - NBA is a professional basketball league in North America.
- michael jordan and scottie pippen - National Basketball Association
- michael jordan and scottie pippen
I searched for michael jordan and scottie pippen
:
"query": {
"bool": {
"must":
[{
"query_string": {
"default_field": "content",
"query": "michael jordan and scottie pippen"
}
}]
}
}
And I expected to get 3 results with same score, but I got 3 results with a different scores.
How can I ignore normalization factors in search time ?
CodePudding user response:
AFAIK, norms
are defined at the field level and not at the analyzer level, can you try disabling norms
on your content
field, you can do it runtime as well as mentioned in official doc and see you are getting expected results.