问题标签 [elastic4s]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
scala - How to make elastic4s store _timestamp field?
I'm able to enable timestamp on a mapping like this :
But to be able to retrieve it when searching using "fields": ["_timestamp"]
it also needs to have store
attribute set to true
. But if I do this :
Then it is not returned by _search
:
The resulting mapping looks like this :
}
But I've got a feeling that it should be like this :
Which cannot be done using elastic4s
Dsl because it doesn't have a special handling for fields named _timestamp
so that the field goes to properties instead of fields in that mapping...
elastic4s - 在多个索引中搜索
当我进行搜索时,是否可以跨多个索引进行搜索?我知道我们可以创建一个别名,但我宁愿不必为给定的用例这样做。“在 index1 中搜索”效果很好。只是希望我能做一些类似“在 index1/index2 中搜索”的事情。
可能是用户错误,但找不到任何相关信息。
谢谢,
小号
scala - elastic4s布尔查询中的elasticsearch“更像这样”
我正在使用 elastic4s 1.5.10 并尝试构建我在 elasticsarch REST 端点上准备的查询。现在尝试重写为elastic4s dsl。
此查询的目标是获取与在同一城市(伦敦)具有相同操作(添加)的 472825948 相似的项目。
我在 elastic4s 中的尝试如下:
“更像”在这种情况下不起作用。原始 json 中的查询没有意义,或者 elastic4s 不支持这个,或者......
有人可以帮忙吗?
谢谢
elastic4s - 带有键列表的 elastic4s 查询文档
我正在尝试从弹性搜索存储库中检索记录。我的方法看起来像这样
}
但是如果id
是字符串列表而不是字符串,我应该使用什么 DSL?
尝试阅读 elastic4s 文档和测试用例,但仍然无法正常工作
scala - 使用 elastic4s 在搜索中获得零结果
这是我用来进行简单搜索的小代码:
这是我得到的结果:
创建索引并将文档添加到该索引运行良好,但简单的搜索查询没有给出任何结果。我什至在 Sense 上检查了这一点。
给
如何解决这个问题?
scala - 如何使用 elastic4s 为索引编写映射/设置?
我需要将上述索引转换settings
为. 我正在使用最新的和.mappings
elastic4s
elastic4s
elasticsearch 1.5.2
我浏览了文档中给出的一些示例,但我无法弄清楚如何做到这一点,就像我试图以这种方式创建它一样:
我无法弄清楚如何使用PUT 请求中给出的store
,index
等。term_vectors
更新: 根据答案,我能够做出这样的事情:
我现在无法弄清楚的是如何将雪球词干分析器和停用词文件路径添加到aplyzer
分析器?
我应该怎么做?
scala - Elastic4s - 为一个术语找到多个精确值
我正在尝试过滤一个术语以匹配数组中的一个值。
中继 ES https://www.elastic.co/guide/en/elasticsearch/guide/current/_finding_multiple_exact_values.html
我试过这个:
但是从 ES 得到一个错误。
我怎样才能做到这一点?
scala - Elastic4s,模拟和验证类型擦除和隐式
在以前版本的 Elastic4s 中,您可以执行类似的操作
在您的测试中执行了几次之后(即一次DeleteIndexDefinition
,随后是两次IndexDefinition
)。每个验证都将与其类型匹配。
但是,Elastic4s 现在在其client.execute
方法中采用了一个隐式参数。参数是 type Executable[T,R]
,这意味着您现在需要类似
这样做之后,我遇到了一个错误。Mockitoclient.execute
在第一次验证中考虑了这三个。是的,即使第一个参数是不同的类型。
那是因为隐式(第二个参数)在类型擦除之后具有相同的类型Executable
。
所以断言失败了。如何在此设置中进行测试?
elastic4s - Elastic4s - 如何表达“matched_fields”
我想在 Elastic4s 中实现以下查询。在荧光笔中看不到任何实现matched_fields子句的方法。有什么帮助吗?