多匹配布尔提升

2024-03-31

我正在尝试执行以下操作

curl -X POST localhost:9200/magento/customer/_search?pretty=1 -d '
{
    "query": {
        "bool": {
            "must": [
                {
                    "multi_match": {
                        "query": "john",
                        "fields": [
                            "firstname"
                        ],
                        "type": "phrase_prefix"
                    }
                }
            ],
            "should": [
                {
                    "multi_match": {
                        "query": "bro",
                        "fields": [
                            "lastname"
                        ],
                        "type": "phrase_prefix",
                        "boost": 10
                    }
                },
                {
                    "multi_match": {
                        "query": "sul",
                        "fields": [
                            "lastname"
                        ],
                        "type": "phrase_prefix",
                        "boost": 1
                    }
                }
            ]
        }
    }
}
'

它在 Johnnie BrousXXXX(已编辑)之前向我返回了 Johnnie SultXXXX 的结果。

似乎提升没有正确应用?我尝试查看有关布尔值的elasticsearch文档:http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html

他们有boost在下面bool节点实际上没有任何意义,您通常想要提升布尔值中的特定一个shoulds...?

UPDATE:

我在创建索引时没有创建任何字段映射。

这是一个结果explain:

{
    "ok": true,
    "_index": "magento",
    "_type": "customer",
    "_id": "6043",
    "matched": true,
    "explanation": {
    "value": 2.3943894,
        "description": "product of:",
        "details": [
            {
                "value": 3.591584,
                "description": "sum of:",
                "details": [
                    {
                        "value": 1.795792,
                        "description": "sum of:",
                        "details": [
                            {
                                "value": 1.795792,
                                "description": "weight(firstname:johnnie in 8931) [PerFieldSimilarity], result of:",
                                "details": [
                                    {
                                        "value": 1.795792,
                                        "description": "score(doc=8931,freq=1.0 = termFreq=1.0\n), product of:",
                                        "details": [
                                            {
                                                "value": 0.18156901,
                                                "description": "queryWeight, product of:",
                                                "details": [
                                                    {
                                                        "value": 9.89041,
                                                        "description": "idf(docFreq=1, maxDocs=14524)"
                                                    },
                                                    {
                                                        "value": 0.018358087,
                                                        "description": "queryNorm"
                                                    }
                                                ]
                                            },
                                            {
                                                "value": 9.89041,
                                                "description": "fieldWeight in 8931, product of:",
                                                "details": [
                                                    {
                                                        "value": 1,
                                                        "description": "tf(freq=1.0), with freq of:",
                                                        "details": [
                                                            {
                                                                "value": 1,
                                                                "description": "termFreq=1.0"
                                                            }
                                                        ]
                                                    },
                                                    {
                                                        "value": 9.89041,
                                                        "description": "idf(docFreq=1, maxDocs=14524)"
                                                    },
                                                    {
                                                        "value": 1,
                                                        "description": "fieldNorm(doc=8931)"
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "value": 1.795792,
                        "description": "sum of:",
                        "details": [
                            {
                                "value": 1.795792,
                                "description": "weight(lastname:sultXXXX in 8931) [PerFieldSimilarity], result of:",
                                "details": [
                                    {
                                        "value": 1.795792,
                                        "description": "score(doc=8931,freq=1.0 = termFreq=1.0\n), product of:",
                                        "details": [
                                            {
                                                "value": 0.18156901,
                                                "description": "queryWeight, product of:",
                                                "details": [
                                                    {
                                                        "value": 9.89041,
                                                        "description": "idf(docFreq=1, maxDocs=14524)"
                                                    },
                                                    {
                                                        "value": 0.018358087,
                                                        "description": "queryNorm"
                                                    }
                                                ]
                                            },
                                            {
                                                "value": 9.89041,
                                                "description": "fieldWeight in 8931, product of:",
                                                "details": [
                                                    {
                                                        "value": 1,
                                                        "description": "tf(freq=1.0), with freq of:",
                                                        "details": [
                                                            {
                                                                "value": 1,
                                                                "description": "termFreq=1.0"
                                                            }
                                                        ]
                                                    },
                                                    {
                                                        "value": 9.89041,
                                                        "description": "idf(docFreq=1, maxDocs=14524)"
                                                    },
                                                    {
                                                        "value": 1,
                                                        "description": "fieldNorm(doc=8931)"
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            },
            {
                "value": 0.6666667,
                "description": "coord(2/3)"
            }
        ]
    }
}

我知道shoulds 是匹配的,因为没有它们,我得到的第一个结果与有它们时不同。

我希望我正在使用phrase_prefix在这种情况下正确地。从文档中我并不完全清楚。此页面引用了它们(http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#_match_phrase_prefix http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#_match_phrase_prefix)但仅在常规上下文中query, not a multi_match.


None

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

多匹配布尔提升 的相关文章

  • Elasticsearch 对字符串排序未返回预期结果

    当对包含多个单词的字符串字段进行排序时 Elasticsearch 会拆分字符串值并使用最小值或最大值作为排序值 即 当对值为 老虎之眼 的字段进行升序排序时 排序值为 Eye 当按降序排序时 排序值为 Tiger 假设我的索引中有 老虎之
  • 使elasticsearch中的所有对象嵌套对象

    是否可以让elasticsearch中的所有嵌套对象自动映射到默认嵌套的类型 而不是对象 是的 您可以使用以下方法来做到这一点动态模板 https www elastic co guide en elasticsearch referenc
  • 分面搜索的后过滤器和全局聚合之间有什么区别?

    搜索界面中的一个常见问题是您想要返回结果的选择 但可能想返回有关所有文档的信息 例如 我想查看所有红色衬衫 但想知道什么 其他颜色可供选择 这有时被称为 多面结果 或者 多面导航 这Elasticsearch 参考中的示例 https ww
  • 为什么我在elasticsearch中需要“store”:“yes”?

    我真的不明白为什么核心类型链接 http www elasticsearch org guide reference mapping core types 它在属性描述中说 例如 对于数字 store 设置为 yes 将实际字段存储在索引中
  • 在elasticsearch中过滤facet

    我有一个如下查询 query query query string query s q filter ids values list ids facets destination terms field destination en hot
  • Elasticsearch 中的嵌套与对象

    有人可以解释 Elasticsearch 文档中 对象 和 嵌套 字段之间的区别吗 我知道默认情况下字段被定义为对象 我还知道我可以用这样的点访问对象字段 my field name my field title 等 对象的文档 http
  • 如何在logstash.conf文件中创建多个索引?

    我使用以下代码在logstash conf中创建索引 output stdout codec gt rubydebug elasticsearch host gt localhost protocol gt http index gt tr
  • 在elasticsearch结果中显示不匹配的单词

    我想显示返回文档的多单词查询不匹配哪些单词 是否有查询类型或参数来实现此目的 通常 此类不匹配的单词会以删除线字体显示给用户 我得到答案后的示例查询 POST posts search query bool should match nam
  • Logstash删除类型并保留_type

    我有一个logstash 客户端和服务器 客户端将带有logstash的udp输出的日志文件发送到服务器 服务器也运行logstash来获取这些日志 在服务器上 我有一个 json 过滤器 它会在实际日志的字段中提取 json 格式的消息
  • 如何在 kibana 中自动配置索引模式

    是否可以在 kibana 中自动配置索引模式 要么通过一些设置文件 要么通过rest api 安装后可以手动完成 Kibana 5 x 公开了这样的 API 来管理索引模式 要创建索引模式 可以发出以下命令来 kibana 访问 url 只
  • 在 Elastic 搜索中加载示例数据集时出错

    您好 我正在尝试加载示例数据集参考弹性搜索文档 https www elastic co guide en elasticsearch reference current exploring your data html但是当我尝试运行指示
  • 如何编写Elasticsearch多个必须脚本查询?

    我想使用查询来比较多个字段 我有字段 1 到 4 我想搜索字段 1 大于字段 2 的数据 并且下面的查询工作正常 size 0 source field1 field2 field3 field4 sort query bool filte
  • 如何在不更改设置的情况下不区分大小写排序

    我的索引名称是 data new 下面是插入索引的代码 test id 1 name A professor Bill Cage accounting id 2 name AB professor Gregg Payne engineeri
  • ElasticSearch 定义自定义映射与默认“_doc”映射冲突

    尝试创建自定义映射类型时会发生此问题 为第一个插入弹性创建自定义映射后想要创建 doc映射类型和冲突就发生在这里 第一步我创建一个映射 mappings properties field1 type keyword field2 type
  • 将 ElasticSearch SearchResponse 对象转换为 JsonObject

    我想将elasticsearch搜索结果转换为Json对象 我还没有找到任何直接转换的正确方法 SearchResponse response client prepareSearch index setExplain true execu
  • 在弹性搜索中使用 GET/POST 时的不同结果

    我正在通过 Elastic Search Head 插件尝试弹性搜索 当我通过 POST 提交查询时 结果符合预期 但是 当我使用 GET 尝试相同的查询时 我总是会返回索引中的所有值 那么 如何通过 GET 将查询传递到弹性搜索服务器 以
  • ElasticCloud 的 ElasticSearch 身份验证错误?

    我刚刚在 ElasticCloud 上设置了一个新的 ElasticSearch 集群 我正在尝试遵循帮助文档 https cloud elastic co help 它说您可以按如下方式发布文档 curl https
  • 无法使用docker在Apple Mac芯片M1上启动elasticsearch

    在发布这个问题之前 我浏览了许多链接 例如 Kibana 无法在 Mac M1 上使用 docker 连接到 ElasticSearch https stackoverflow com questions 73160632 kibana c
  • Elastic Beanstalk 添加多个 ssl 证书

    我有一个 Docker Django api 应用程序 可以从多个域 abc xyx com 或 def lmn com 调用 我已从 Elastic beanstalk 中的配置控制台成功添加了 abc xyz com 的 ssl 证书
  • Elastic Search 启动错误 - “\Common 此时出现意外。”

    我已经下载并解压了elasticsearch 当我运行批处理文件 elasticsearch bat 时 出现以下错误 Common was unexpected at this time Solved 通过编辑 bat 文件的第 46 行

随机推荐

  • 使用 time min() 和 time max() 从选定的某个值 id 表中删除不必要的时间

    我尝试删除不必要的时间 因为我只需要min and max 数据 来自选定的 ID 并且还通过 Stack Overflow 阅读了同样的问题 SQL 仅选择列上具有最大值的行 https stackoverflow com questio
  • 需要将图像固定到页面上的特定位置

    我需要将 gif 图像修复到主页上的特定位置 我已将图像放入 HTML 中 但 position fixed 并没有执行我想要的操作 页面内容的其余部分在图像下方滚动 我希望图像始终保持在同一个位置 免责声明 我对 HTML 和 CSS 几
  • 在php中使用fpdf/fpdi添加垂直文本

    我有一个脚本可以从数据库 blob 构建多页 pdf 这个pdf文件可以工作并输出良好的电流 但我需要在每页的左侧添加一条垂直的文本行 我已经设法让它适用于某些 pdf 文件 但对于某些 pdf 文件 我收到损坏的文件错误 有谁有不同的方法
  • Visual Studio 2013 更新 3 的问题

    我刚刚安装了 VS 2013 Update 3 现在打开解决方案时出现错误 The Microsoft VisualStudio Web Publish WebPublishPackage MircosoftVisualStudio Web
  • 如何借助 amp-story-consent 构建 AMP cookie 同意?

    我想向我的 AMP 静态网站添加 cookie 同意 我想利用模式对话框amp story consent可以提供给我 我研究了各种例子 也许最完整的是 示例文档https amp dev documentation examples us
  • 新 PayPal 结账时大型购物车的 PayPal HTML 按钮损坏

    几周以来 我们一直在与 PayPal 支付标准表格问题作斗争 我们多年来一直运行相同的代码 但注意到我们的较大发票 包含 20 多个项目 最近在提交给 PayPal 时出现白屏死机 沙盒中的测试和以前一样运行良好 在到处搜索后 我找不到任何
  • 桌面应用程序转换器

    我使用 Desktop Bridge 一段时间了 最 近我开始遇到问题 它停止构建软件包 我尝试将其安装在不同的虚拟机上 但遇到了相同的错误 PowerShell Error Record DesktopAppConverter error
  • 如何使 CATransform3dMakeRotation 以另一种方式旋转?并链在一起

    我第一次使用一些核心动画 在实现可以翻转的扑克牌的过程中 我决定使用CALayer显示内容 不确定我将如何获得两侧 但这是另一个问题 并且我需要能够翻转它 移动它等等 我在用着CATransaction取得了一些成功 在下面的代码片段中 卡
  • 以识别自定义 if 语句的方式解析纯文本

    我有以下字符串 string The man has NUM DOGS dogs 我通过以下函数运行它来解析它 function parse text string global num dogs string str replace NU
  • Visual Studio 2010 中的代码指标

    我想知道 Visual Studio 2010 中的代码指标有哪些可用选项 我知道可以在 IDE 中对代码运行手动指标 但是还有其他选项吗 我想做的是 我和我的团队正在运行 Team Foundation Server 2010 并且我们设
  • phpunit 测试类未找到错误,而类存在?

    这是我的目录结构 application modules admin models User php 这是我的用户模型类 class admin Model User User php 这是我的 UserTest 类 带有简单的 Asser
  • 计算直线与 x 轴之间的角度

    我目前正在为 Android 开发一个简单的 2D 游戏 我有一个位于屏幕中心的固定对象 我试图让该对象旋转并指向用户触摸的屏幕区域 我有代表屏幕中心的常量坐标 我可以获得用户点击的点的坐标 我正在使用此论坛中概述的公式 如何获得两点之间的
  • glsl 中的 mat3(mat4 矩阵)语句有何作用?

    我正在做每个片段照明 并且在校正法线向量时 我得到了以下代码 vec3 f normal mat3 MVI normal 其中 MVI 是 mat4 MVI transpose inverse ModelViewMatrix 那么返回之后是
  • 如何处理 Blackberry Storm 中的 ButtonField 和 BitmapField 点击(触摸)事件?

    我创建了一个 ButtonField 和一个 BitmapField 像 public class MyCanvas extends MainScreen implements FieldChangeListener HorizontalF
  • 如何在Table View定制过程中调用“willDisplayHeaderView”方法?

    我想调用这些方法 void tableView UITableView tableView willDisplayHeaderView UIView view forSection NSInteger section NS AVAILABL
  • 如何防止标签在移动屏幕 Chart.js 上重叠

    我正在使用这个例子jsfiddle https jsfiddle net Trekels fec0v5kj 但是当我使用小屏幕时标签开始像这样重叠 我可以做什么来预防它 我想让它完全响应 我尝试改变长度和其他长宽比等 但没有成功 var c
  • 缓存是个好主意吗?如果是的话,在哪里?

    我有一个 ASP NET 网站 每天有 10 25 000 名访问者 节假日前的峰值超过 60 000 人 由于它是一个内容网站 因此页面 访问量也很高 我有一些特定的页面 它们产生了大约 60 的流量 这些页面有点复杂 并且数据库较多 s
  • Xcode 4.2:如何从子项目导入 .h 文件

    我是 Xcode 子项目的新手 在我的 iPhone 应用程序项目中MyProject 我正在尝试将一些常见代码重构为一个名为的静态库项目MyLibrary 我创建后MyLibrary并移动代码 MyProject不再编译 错误在于MyPr
  • 在 openCV 中连接足够近的轮廓

    我有一组从图像中检测到的轮廓 斑点 问题在于 一些斑点在斑点检测和平滑过程中被分割 我尝试使用以下代码 Mat outlines Mat zeros m3 size CV 8UC3 findContours m3 contours CV R
  • 多匹配布尔提升

    我正在尝试执行以下操作 curl X POST localhost 9200 magento customer search pretty 1 d query bool must multi match query john fields