问题标签 [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.

0 投票
1 回答
900 浏览

scala - elastic4s上未找到值索引错误

我试图通过使用 elastic4s API将一些数据索引到弹性搜索

但我得到编译错误 not found: value index

这是代码,稍后我会将js对象字段映射到弹性搜索字段, 但现在我只想索引一个测试用例

这是 SBT 文件

libraryDependencies ++= Seq( jdbc, anorm, cache, "org.webjars" %% "webjars-play" % "2.2.1", "org.webjars" % "bootstrap" % "3.1.0", "org.webjars" % "jquery" % "2.1.0-1", "com.sksamuel.elastic4s" %% "elastic4s" % "1.0.0.0"
)

这是完整的错误

[error] /home/mik/programing/posts/app/helper/Helper.scala:27: not found: value index [error] index into "posts/test" id id.toString() fields ( [error] ^ [error] one error found [error] (compile:compile) Compilation failed [error] Total time: 2 s, completed Feb 15, 2014 1:34:54 PM

我在安装过程中错过了什么吗?

还是别的什么??

谢谢三木

0 投票
3 回答
1064 浏览

scala - elastic4s and play framework 2.2.1

i'm trying to index some data to elastic search by using the elastic4s API and play framework

I'm basically calling this method from the controller

I didn't get any error on play or in the elastic search log,

Then i checked with the Sense plugin if the data is indexed and i got

It looks like the query didn't go to the server?? ...

0 投票
1 回答
1470 浏览

scala - 将 elastic4s 与弹性搜索和喷射路由一起使用时出现异常

我正在尝试使用 Scala、Spray.io、Elastic4s 和 ElasticSearch 编写一个小的 REST api。我的 ES 实例使用默认参数运行,我只是将参数 network.host 更改为 127.0.0.1。

这是我的喷雾路由定义

我的 crudController :

还有一个特性 elastic4s 封装了对 elastic4s 的调用

这段代码运行良好,并给了我这个输出:

但是当尝试使用我的浏览器访问路由“localhost/ads/8”时,总是会触发失败案例,并且我在我的 intellij 控制台上得到了这个错误输出:

(在我的终端上运行 elasticSearch 时没有控制台输出)

此异常是否与 ElasticSearch 有关,还是我的 Future 声明做错了?

0 投票
1 回答
1126 浏览

scala - IndexMissingException 与 scala 和 elastic4s

你好stackoverflowers!

我正在尝试将库 elastic4s 与 scala 一起使用,但是当我运行以下代码时(为了获取索引广告中的广告列表):

我得到了这个例外:

Pastebin在这里有完整的输出。

这是我的配置:

Elastic Search 已在 localhost:9200 上启动并运行,并且存在此索引广告。这个 CURL 请求:

返回

我无法理解...如果有人可以给我一个曲目:)

0 投票
2 回答
2177 浏览

scala - 使用 Elastic4s 的动态 ElasticSearch 映射

我有一个要在 elasticSearch 上索引的文档,该文档包含一些我无法提前知道的动态键,例如以下示例中的“西班牙语”或“法语”

我正在使用 elastic4s DSL 来制作我的映射(通过 createIndex DSL),但我找不到如何使用这个库创建基于“匹配”选项的动态映射(如建议的here),在为了为存储在路径 contents.title 下的每种语言指定不同的分析器。

请问有什么音轨吗?:-)

0 投票
1 回答
594 浏览

scala - 使用 DocumentMap 索引嵌套对象

我正在尝试使用 DocumentMap 创建批量索引。我像这样映射类

这就是我索引数据的方式(现在我只能索引单个项目),

我有两个问题

1.我应该在索引之前将属性注释映射为嵌套吗?因为现在所有列表都被索引为单个字符串。

2.如何索引帖子对象列表?现在我只能索引单个对象。

解决方案

1.首先也是非常重要的在索引之前创建一个映射。

2.使用这样的批量索引。

谢谢三木

0 投票
2 回答
1799 浏览

scala - 在 elastic4s 中执行 GET 时字段为空

我正在尝试在我的 play2 应用程序中实现一项服务,该服务使用 elastic4s 通过 Id 获取文档。

我在 elasticsearch 中的文档:

我的服务:

如果我在响应对象上使用 getFields(),我会得到一个空对象。但是,如果我调用 response.getSourceAsString,我会得到 json 格式的文档:

如您所见,获取请求会省略信息:

如果我尝试进行常规搜索:

我得到:

我的索引服务:

和索引:

  1. 为什么 getFields 在做get时是空的?
  2. 为什么在获取请求 中执行 getSourceAsString 时会遗漏查询信息?

谢谢!

0 投票
1 回答
471 浏览

scala - ElasticSearch:Elastic4s 只索引一个字段

我正在使用 ElasticSearch 来索引我的一些模型,但我看到只有一个字段updated被索引;

我首先创建一个映射,例如;

然后,在方法Shop.save中,我执行以下操作;

但是,当我去 时host:9200/places/shop/1,我只看到:

我究竟做错了什么?

编辑我正在使用:elastic4s 1.3.2 elasticsearch 1.3.2 和 Scala with the Play Framework (2.3.4)

0 投票
1 回答
678 浏览

scala - 使用 elastic4s 进行 GeoDistance 查询

我在理解用于形成 GeoDistance 查询的 DSL 语法时遇到了一些麻烦(获取距某个点一定距离内的所有条目);

目前,在我的 ES 索引"places" -> "shops"中,id = 1我有一个示例条目;

然后,使用 Elastic4s DSL,我正在构建一个搜索查询;

在这种情况下:

所以无论如何,如果查询是正确的,这应该给我包含 ES 中的条目的结果,因为它与条目位于同一点,因此在 50 公里的距离内。

查询成功但结果为空。

编辑:这是映射的样子;

这有什么问题?

0 投票
0 回答
349 浏览

scala - elastic4s + elasticsearch Geodistance查询,两个文档位于同一位置

我正在使用 Elasticsearch 来索引地理数据,并且我有两个点被索引;

然后我还有一点;

映射是正确的

然后我正在查询(49.9999、49.9999)内500公里内的所有点,我确定这些点在距离之内;

只给我一击。完全相同的查询 viacurl给了我两次点击。这可能是 Elastic4s 的错误吗?