问题标签 [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.
elasticsearch - Why ElasticSearch Java Client index Future completes before the record is searchable?
I'm using elastic4s client that returns a Future
in response to index request and when that future completes I still have to do Thread.sleep(1000)
before I can query for that indexed record. Mostly it is exactly 1 second. Is there an elasticsearch setting that I can change so that when the Future completes the record will be available?
I tried to use the java client directly client.prepareIndex....execute().actionGet();
and it ends up exactly the same way, I have to call Thread.sleep(1000)
Is there any settings I can change for the record to be ready after the future completes?
sbt - Elastic4s 对 org.elasticsearch 的依赖,我可以摆脱它吗?
我刚刚意识到 elastic4s 对 org.elasticsearch 有依赖关系,并且该依赖关系正在下载 20 Mb 的库。
对于我在 elastic4s 的 github 存储库中看到的内容,代码中有 66 个对包 org.elasticsearch 的引用。尽管如此,就 elastic4s 是一个客户端而言,我想知道是否有办法摆脱它的这种依赖关系,或者至少让它不那么沉重。
欢迎对此提出任何想法?
提前致谢。
scala - Elasticsearch 脚本将元素添加到数组中
我正在一个 scala 项目中研究 ElasticSearch。我使用elastic4s作为客户端。我正在尝试将元素从迭代器中逐个添加到文档中。
上面的代码不起作用产生以下错误:
问题出在我假设的脚本上,但我找不到任何解决方案。请帮忙...
scala - 从scala中的elastic4s获取搜索结果
我有以下代码,我正在尝试从弹性搜索中获取所有命中。如果我尝试在没有查询部分的情况下编写它,那么当我调用 .getHits 时它只会给我 10 个结果。
另一个问题是查询部分实际上不起作用,我什么也没得到。这是我的弹性搜索中的一个结构。
python - 使用 elastic4s 查询产生零结果
我正在玩和学习用于弹性搜索的 scala 和 elastic4s。
我有一个使用官方 elasticsearch 模块的 python 脚本。我在 python 中的代码如下所示:
我上面的python代码有效。我得到 90 万个结果,然后处理它们等等。
我正在使用基本的 scala 代码来试用 e4s。这只是一个简单的查询。我的查询错了吗?
我运行这个的结果:
以及 curl 查询的响应:
scala - elastic4s - 在多个字段中搜索
我正在使用elastic4s
客户端进行我的 scala 弹性搜索,并尝试在多个字段上进行搜索,例如:
"query": { "match": { "_all": { "query": "SomeTermToMatch", "operator": "and" } } }
我试过了:
query { '_all', query(searchString)).operator(MatchQueryBuilder.Operator.AND) }
但它并没有像原生 es 那样返回想要的结果。
有人知道我怎样才能做到这一点吗?
scala - 在 elastic4s 中创建后如何更改索引的设置?
我需要在批量索引(千兆字节)的过程中禁用索引刷新,并在完成后将其重新设置。但是从elastic4s的源代码中,除了创建索引时,我找不到其他方法……有可能吗?或者有解决方法吗?
在 java 客户端中:
本机:
scala - 由另一个类组成的 Elasticsearch 索引数组
我有一个类,我想使用 Scala 客户端 elastic4s 开始对 ElasticSearch 进行索引。我扩展了 DocumentMap 以允许我插入文档。String、Int 等简单值正在工作,但我似乎无法正确映射另一个类的列表。
文档看起来与此类似:
它将在 elasticsearch 中很好地映射 Id 字段,但是当将文档插入到 elasticsearch 中时,我得到一个看起来类似于此的不正确值:
显然这是错误的,一旦它被插入到 elasticsearch 中,我期待与这个 JSON 结构类似的东西,例如:
有谁知道在使用 elastic4s 索引数据时映射复杂类型数组的方法?
scala - 如何将带有映射模板的索引放入带有elastic4s的弹性搜索中?
我想用动态模板创建索引并关闭字符串字段的分析。我已经为弹性搜索创建了查询,但是如何将其转换为 elastic4s 语句?(版本 elastic4s 1.3.x 是首选)
声明是:
附言
可能可以通过执行这个“原始”请求来创建这个索引,但我没有找到如何使用 elastic4s 1.3.4 :(
scala - scala中花括号和括号之间的真正区别
在使用 Scala 一段时间并阅读所有地方,尤其是这里
我确信我知道什么时候使用卷发。根据经验,如果我想传递要执行的代码块,我将使用花括号。
这个讨厌的错误是如何使用花括号的 elastic4s DSL 浮出水面的:
编译为:
使用括号时:
给出正确的结果:
这是使用 scala 2.11.6 编译的 - 更令人困惑的是,无论我使用什么,在 intellij 调试器中评估表达式都会给出正确的结果。
我注意到只有最后一个表达式正在被评估,为什么会这样?