It is possible to limit amount of hits per token?

I have indexed refBook of materials:
doc/id name
1 polibutilen
5 polibutelenteraftalat
13 elastan,
23 elastodien,
25 elastodin

query could contain many materials (using OR operator): elastan, polibutilen.

(example data as unique in English, but real data in other language, so I am using for matching only landuage stemmer (ending could be variable in query).

As a result of search I hitted all this materials, but I need only best hit for each token (for query elastan, polibutilen, only docs 13,1).
Is it possible to set such a limit? If not what can be another way of implementation of such a logic in elasticsearch?

Hi @va2dim

Could you tell if you are using any analyzer? It would be perfect if you share your mapping/settings so that it is possible to carry out a simulation.

_mapping

{
"materials": {
"mappings": {
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "text",
"analyzer": "SearchQueryAnalizer",
"fielddata": true
}
}
}
}
}

_settings

"materials": {
"settings": {
"index": {
...
"provided_name": "materials",
"max_result_window": "50000",
"creation_date": "1670319872418",
"analysis": {
"filter": {
"russian_stemmer": {
"type": "stemmer",
"language": "russian"
}
},
"analyzer": {
"SearchQueryAnalizer": {
"filter": [
"russian_stemmer"
],
"type": "custom",
"tokenizer": "standard"
},
"IndexDataAnalizer": {
"filter": [
"russian_stemmer"
],
"type": "custom",
"tokenizer": "standard"
}
},
"tokenizer": [
"standard"
]
},
'SearchQueryAnalizer' => [
                'type' => 'custom',
                'tokenizer' => 'standard',
                'filter' => ['russian_stemmer'],
            ],
filters = [
            'russian_stemmer' => [
                'type' => 'stemmer',
                'language' => 'russian',
            ]
Example of indexed documents in russian lang:
id/doc,name
1, эластан,
2, эластодин, 
3, эластодиен 
4, полибутилен
5, полибутилентерафталат
6, акрил, 
7, акрилонитрил

Example of query in russian: 20% эластана, 80% полибутилена

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.