简体   繁体   中英

ElasticSearch. Priority does not work

I have a wrong results when I use cross_fields search When i send this query

{'from': 0, 
 'sort': ['_score'],
 'size': 400,
 'query': {
       'bool': 
           {'must': 
               {'multi_match': 
                   {'type': 'cross_fields', 
                    'fields': ['nickname^1', 'pedigree_name^0.4', 'breed^0.2', 'city^0.1', 'country^0.05'],
                    'operator': 'and',
                    'query': 'Akita'}
               }
           }
   }
}

I get this results 在此处输入图片说明

But why? Pedigree_name priority are higher then breed priority

I believe the reason is that your query type is 'cross_fields'. It "analyzes the query string into individual terms, then looks for each term in any of the fields, as though they were one big field." Further rom here :

Note that cross_fields is usually only useful on short string fields that all have a boost of 1. Otherwise boosts, term freqs and length normalization contribute to the score in such a way that the blending of term statistics is not meaningful anymore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM