- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在索引的names
字段中执行术语汇总时,我得到了错误的结果。
以下是我使用的names
字段的映射:
{
"dbnames": {
"properties": {
"names": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
terms
聚合得到的结果:
"aggregations": {
"names": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "John Martin",
"doc_count": 1
},
{
"key": "John martin",
"doc_count": 1
},
{
"key": " Victor Moses",
"doc_count": 1
}
]
}
}
最佳答案
最简单的方法是确保在建立索引时正确区分names
字段的值。
如果这不是一个选择,那么实现此方法的另一种方法是定义一个将为您执行此操作的分析器,并将该分析器设置为index_analyzer
字段的names
。这样的自定义分析器将需要使用 keyword
tokenizer(即,将字段的整个值作为单个标记)和 lowercase
token filter(即,将值小写)
curl -XPUT localhost:9200/your_index -d '{
"settings": {
"index": {
"analysis": {
"analyzer": {
"casing": { <--- custom casing analyzer
"filter": [
"lowercase"
],
"tokenizer": "keyword"
}
}
}
}
},
"mappings": {
"your_type": {
"properties": {
"names": {
"type": "string",
"index_analyzer": "casing" <--- use your custom analyzer
}
}
}
}
}'
curl -XPOST localhost:9200/your_index/your_type/_bulk -d '
{"index":{}}
{"names": "John Martin"}
{"index":{}}
{"names": "John martin"}
{"index":{}}
{"names": "Victor Moses"}
'
terms
字段上的
names
聚合将返回您的预期结果:
curl -XPOST localhost:9200/your_index/your_type/_search-d '{
"size": 0,
"aggs": {
"dbnames": {
"terms": {
"field": "names"
}
}
}
}'
{
"dbnames": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "john martin",
"doc_count": 2
},
{
"key": "victor moses",
"doc_count": 1
}
]
}
}
关于elasticsearch - Elasticsearch中 splinter 的聚集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33428307/
所以我使用 splinter 登录到一个站点,然后我在登录后抓取 cookie,然后将其保存为 pickled 对象以备后用。 def save_cookie(username, password):
嗨,我想升级我的单声道版本,以便能够使用某些 .Net 4 功能。 我下载了 2.10 压缩包并按照我发现的说明进行了编译,这似乎进展顺利。 这是我得到的输出: $mono -V Mono JIT c
我是 Pov-Ray 的初学者,我正在尝试在 Pov-Ray 中创建一个车床对象,但它看起来有点破损。有人可以给我一些关于如何修复它的建议吗? 我用来创建的代码是 #include "colors.i
from splinter import Browser browser = Browser() browser.visit('http://www.google.com/') 直接从他们的教程开始,
最近,我注意到我的视差代码从左到右出现奇怪的抖动。代码非常简单: $(window).scroll(function(){ var body = $('body'); var top
我尝试了 overflow:hidden 解决方案来解决破坏 border-radius 的背景:http://jsfiddle.net/ypjDC/17/ test tes
当我将 Nilorea 库中的这个多行宏包含在我的 C++ 项目中时,它无法编译。它被标记为外部“C”。 尝试了 GodBolt,GCC 8.1 编译器在以下代码中的 if 语句上 barfs:htt
我在 python 上使用 splinter 模块。我需要检查一个元素在页面上是否可见,似乎唯一的判断方式是 style="display: none;"我找不到检测方法。 如何检查? 最佳答案 如果
这个问题在这里已经有了答案: left and top properties are not animated (2 个答案) 关闭 6 年前。
我需要通过传递一个字符串数组来在页面上执行 JavaScript 函数。我想避免多次调用 browser.execute_script 。 list_of_strings = ['a','b','c'
我正在尝试在以下方面进行浏览器自动化: https://play.google.com/store/apps/details?id=org.mozilla.firefox&hl=en 我可以使用以下方
鉴于此(“ sleep ”方法是为了让您可以看到我正在看的内容): from splinter import Browser import time #from selenium.webdriver.
我使用的是相对简单的组合布局,它确实有效,但在某些情况下,我的 UICollectionView 中的最后一两个单元格的宽度似乎不正确。 我的 collectionView 由具有动态宽度和静态高度的
我的对象列表是如此初始化: $( function() { var $container = $('div.hikashop_products'); $container.isotop
我正在使用jPlayer在页面中嵌入两个音频文件,基本上代码是cut'n'pasted from this page。一个是wav,另一个是mp3。在本地(mac)上一切正常,但是当我将其上传到服务器
在索引的names字段中执行术语汇总时,我得到了错误的结果。 以下是我使用的names字段的映射: { "dbnames": { "properties": { "names"
我想对视频播放(基于 AVPlayer)产生类似 splinter 的效果,它将转换到另一个视频或图像。 是否可以在 iOS5/6 中对这种视频创建这种效果? 如果不是,另一种方法是在最后播放帧的静止
我正在使用 Flask 尝试提供经过处理的图像,例如在模型处理后裁剪或将其转换给用户,但总是很短,因为它会产生一些错误。当我使用 numpy.rot90() 时,它没有按计划旋转我的图像,而是得到了这
XMFLOAT4X4 在矩阵定义中使用并内的并,但是当我尝试使用和不使用额外并的相同方法时,我会在访问模式中得到不同的结果。我不确定这是否是在 union 的初始化中,或者我在实现中可能会出错的地方。
这两条线实际上是点,但是当我运行 lineIntersects 方法时,我得到“true”作为返回值,有谁知道发生了什么或者这是一个错误?这是 documentation link这是source ,
我是一名优秀的程序员,十分优秀!