简体   繁体   English

提高查询中的Elasticsearch字段和字段中的单词

[英]Boosting on an elasticsearch field and words in the field within the query

I am trying to achieve the following scenario... 我正在尝试实现以下方案...

Within my elasticsearch index will be a number of specific records that i want to be the number 1 result if the query contains specific words within this field. 如果查询在此字段中包含特定单词,则在我的Elasticsearch索引中将包含许多特定记录,我希望它们是结果1。 This field is company name so for example if someone puts 'ford' into the search the company name field will have a boost over all other fields so this is highest score..... this seems to work for me with the single word... ford, nissan etc... 该字段是公司名称,因此例如,如果有人在搜索中输入“ ford”,则公司名称字段将比所有其他字段都有提升,因此这是最高分.....这似乎对我来说很有效。 ..福特,日产等...

however... if the query is say 'ford car sales' then other pages are ranked higher than the one i want because of course many pages contain all these terms (the search operator is AND)... but is there a way to still rank my page top by being able to boost words in the company name field irrespective of how many words are in the query or found elsewhere..... 但是...如果查询中显示“福特汽车销售”,则其他页面的排名高于我想要的页面,因为许多页面包含所有这些术语(搜索运算符为AND)...但是有一种方法可以不管查询中或在其他地方找到多少个单词,都可以通过在公司名称字段中增加单词来将我的页面排名保持在顶部。

finally could i somehow set up variations of company names to the one in the field to boost these results... so where name is fiat-chrysler, set up other variations a user may search on such as 'fiat chrysler' without the hyphen.... 最终,我可以以某种方式在现场设置公司名称的变体以提高这些结果...因此,在名称为菲亚特克莱斯勒的地方,设置用户可以搜索的其他变体,例如没有连字符的“菲亚特克莱斯勒”。 ...

thanks for any help.... 谢谢你的帮助....

In your query when you use "field" to specify the fields you are searching in, add boosting to 'company name' field by using ^. 在查询中,当您使用“字段”来指定要搜索的字段时,请使用^将升号添加到“公司名称”字段中。

Example: 例:

{
    "fields": ["company_name^10","other_field_a", "other_field_b"],
    "query" : {
        "term" : { "company_name" : "ford" }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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