问题标签 [elasticsearch-2.0]

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 回答
10704 浏览

elasticsearch - 如何在elasticsearch 2.0中设置_id

由于不推荐使用特定映射字段path上的配置(如此的文档中所述), _id

如何_id在 elasticsearch 2.0 中为特定文档设置字段?

(在我的特定用例中,我想用我自己的 id 索引所有文档。我知道它们都是唯一的)

0 投票
1 回答
369 浏览

elasticsearch - Elasticsearch 2.0.0 中的采样器聚合

使用简单的查询,我得到一堆文档,其中每个文档都有一个bucketID。我正在尝试使用采样器聚合来按照它们出现在一般查询中的顺序获取存储桶 ID。

但是当我运行上述查询时,我会按升序获得存储桶,它们甚至不是我从一般查询中得到的存储桶。

例如

您可以看到聚合不是所需的。我怎样才能[22570, 12239]按顺序获得?

0 投票
3 回答
19291 浏览

elasticsearch - 如何在 Loopback 和 Non-Loopback 接口上绑定 Elasticsearch 2.0?

从 2.0 版本开始,Elasticsearch 默认只绑定在环回接口上(_local_在配置方面)。

文档说有一种方法可以切换到另一个网络,例如,_non_loopback_绑定到第一个非环回接口。它工作正常。

但我不知道如何组合这些设置,以便 Elasticsearch同时绑定环回和非环回接口?

PS。我的原因是我在通过 localhost 连接到它的每个 Elasticsearch 实例上使用 Logstash,但我也希望其他 Elasticsearch 实例能够看到彼此以形成集群......

0 投票
1 回答
937 浏览

elasticsearch - docker 中的 Elasticsearch 2.0.0 集群 zen 发现

我尝试以 docker 方式在谷歌计算引擎的 2 个不同节点上运行 elasticsearch 集群。

使用 1.7.1,单播工作,但使用 2.0.0,它不起作用,2 个节点不能连接在一起

下面是Dockerfile,run commandelasticsearch.yml。谢谢

Dockerfile

运行命令

弹性搜索.yml

node-a 的控制台

node-b 的控制台

0 投票
1 回答
5027 浏览

elasticsearch - Elasticsearch 2.0:_id 不可配置

ES 2.0 刚刚发布。出于好奇,我针对 ES 2.0 测试了适用于 ES 1.7.3 的映射文件。我收到以下错误:

基本上,这个错误抱怨我的映射文件包含以下内容:

刚刚做了谷歌,并没有找到一种方法将 doc _id 设置为 ES 2.0 中索引文档的实际标识符。我怎样才能做到这一点?

感谢任何指针和输入!

0 投票
4 回答
10719 浏览

elasticsearch - Elasticsearch 2.0: how to delete by query in Java

I am trying to upgrade to ES 2.0. I have downloaed ES 2.0 and installed it on my Windows machine.

In my pom.xml, I have the following:

In my Java code, I did delete by query in the following way when using ES 1.7.3:

I am hoping to replace this:

with ES 2.0 way. Googled but failed to find an example for it. The online API documentation seems too abstract to me. How can I do it?

Another question: Do I have to install delete-by-query plugin in Elasticsearch server?

Thanks for any pointer!

UPDATE

I followed Max's suggestion, and here is what I have now:

First, when create the client, make settings look like the following:

Second, at the place doing delete-by-query:

I also installed delete by query plugin by running the following in the root directory of ES:

I get errors if I do not install this plugin.

After all these steps, ES related parts work just fine.

0 投票
1 回答
1041 浏览

elasticsearch - 使用 docker 运行弹性搜索

我是弹性搜索的新手,如果我的问题很愚蠢,请原谅我。我正在尝试用 docker 运行它。从 docker hub 提取 elasticsearch 图像后,我使用以下命令运行它:

docker run -p 9200:9200 -p 9300:9300 --name=ES elasticsearch

但是当我打开http://192.168.99.100:9200(我的 docker-machine ip 是192.168.99.100)时,页面不可用。

我试图改变我的elasticsearch.yml喜欢如下:

network.publish_host: 192.168.99.100

但它不起作用。有人帮我吗?

谢谢。

更新 1

我尝试network.publish_host使用(如@Val 提到的)直接在命令行上传递设置,--network.publish_host=192.168.99.100但它仍然无法正常工作。这里的日志:

0 投票
2 回答
3774 浏览

ubuntu - Cannot access Elasticsearch 2.0 in Vagrant VM from host OS

I'm trying to get Elasticsearch 2.0 up and running in a Vagrant VM. The method I was using for 1.7 no longer works, so I'm trying to update my method. I can get ES 2.0 installed in the VM, and it seems to work fine from within the VM, but I can't access it from outside the VM. It's like the VM isn't port-forwarding port 9200 for some reason, even though I'm telling it to. So I'm trying to figure out what I'm doing wrong.

Given this Vagrantfile:

my old bootstrap.sh works fine:

I mean that it works in the sense that, from the host OS (OS X 10.9.5) I can curl ES just fine:

But when I use this new version of bootstrap.sh which I cooked up by trying to follow the Elasticsearch documents (always an arduous task):

does NOT work. From inside the VM, curl localhost:9200 works as expected, but from the host OS I get:

What am I missing here? Can anybody tell me why isn't the new version port forwarding?

0 投票
1 回答
1879 浏览

ruby-on-rails - Homebrew:无法启动弹性搜索

我遇到了大麻烦,我无法启动 Elasticsearch,我需要它来在本地运行我的 Rails,请告诉我发生了什么。我以正常方式安装了 Elasticsearch,然后执行了以下操作:

但它显示以下错误:[2015-11-01 20:36:50,574][INFO ][bootstrap] es.config is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed.

我尝试了几种运行它的替代方法,例如:

但是后来我收到以下错误,我找不到任何有用的解决方法,它似乎与文件权限有关,但不确定:

谢谢你的帮助。

0 投票
1 回答
1090 浏览

elasticsearch - Elasticsearch - Has_Parent 或 Has_Child 查询返回空结果

我正在使用 Elasticsearch RC 2.0.0。

我的 Elasticsearch 数据库中有一些父子关系。我想检索与父对象相关的所有子项。我总是收到一个空的结果列表。我遵循了 elasticsearch 文档的说明,并将我的代码与几本书进行了比较。我不明白,为什么我的查询应该返回一个空结果。

在这种情况下,我构建了一个简化的示例。我将两个对象放入 elasticsearch 并将对象 a 设置为对象 b 的父对象。然后我尝试检索所有对象,其中有一个类型为 a 的父对象。

这是我的输入:

这将返回