小编cen*_*etp的帖子

当搜索单个"已加星标"的术语时,Elasticsearch会为所有结果输出1.0分

我们使用Elasticsearch搜索特定目录中最相关的公司.当我们使用正常搜索词时,lettering我们得到合理的分数,并可以根据分数对结果进行排序.

但是,当我们在查询之前修改搜索项并使其"加星标"版本(例如*lettering*)能够搜索子字符串时,我们得到的结果为1.0.搜索子串是项目中的一项要求.

关于什么可能导致这种相关性计算的想法?仅在使用单个术语时才会出现此问题.当我们组合使用两个加星标的术语时,我们会得到可理解的分数(例如*lettering* *digital*).

编辑1:

示例性映射(YAML,其他属性以相同的方式映射,除了对每个属性不同的boost):

    elasticSearchMapping:
      type: object
      include_in_all: true
      enabled: true
      properties:
        'keywords':
          type: string
          include_in_all: true
          boost: 50
Run Code Online (Sandbox Code Playgroud)

查询:

{
"query": {
    "filtered": {
        "query": {
            "bool": {
                "must": [{
                    "match_all": []
                }, {
                    "query_string": {
                        "query": "*lettering*"
                    }
                }]
            }
        },
        "filter": {
            "bool": {
                "must": [{
                    "term": {
                        "__parentPath": "/sites/industrycatalog"
                    }
                }, {
                    "terms": {
                        "__workspace": ["live"]
                    }
                }, {
                    "term": {
                        "__dimensionCombinationHash": "d751713988987e9331980363e24189ce"
                    }
                }, {
                    "term": …
Run Code Online (Sandbox Code Playgroud)

elasticsearch

3
推荐指数
1
解决办法
1949
查看次数

标签 统计

elasticsearch ×1