如何在弹性搜索中插入数据 [英] How to insert data into elasticsearch

查看:176
本文介绍了如何在弹性搜索中插入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是elasticsearch的新人,我一直在尝试2天插入一些数据到elasticsearch。
我在google上发现有很多页面来帮助创建一个索引(我不清楚inde,是否意味着插入在其他术语?)
然后许多地方给一些curl命令,我真的不知道在哪里执行这些代码行来插入数据,例如:

I am new to elasticsearch, and I have been trying for 2 days to insert some data into elasticsearch. I found on google that there are many pages to help to create an index (I am not clear about inde, does it mean "insert" in other terms?) Then many places give some curl command, and I realy don't know where to execute these code lines to insert data, Example:

curl -XPOST "http://[localhost]:9200/indexname/typename/optionalUniqueId" -d '{ "field" : "value" }'

我使用Window 7,我安装Java并运行elasticsearch成功
任何人都可以显示更多关于如何在弹性搜索中插入数据的细节。

I am using Window 7 and I have install Java and run elasticsearch successfull Could anybody show me more detail about how to insert data into Elastic Search

非常感谢

推荐答案

您必须安装 curl 你的电脑。您可以下载它从这里

You have to install the curl binary in your PC first. You can download it from here.

然后将其解压到一个文件夹中。让我们说 C:\curl 。在该文件夹中,您将找到具有多个 .dll 文件的 curl.exe 文件。

After that unzip it into a folder. Lets say C:\curl. In that folder you'll find curl.exe file with several .dll files.

现在从开始菜单中键入 cmd 打开命令提示符。然后键入 cd c:\curl ,它会带你到curl文件夹。现在执行 curl 命令。

Now open a command prompt by typing cmd from the start menu. And type cd c:\curl on there and it will take you to the curl folder. Now execute the curl command that you have.

有一件事,Windows不支持单引号字段。所以你必须使用双引号。

One thing, windows doesn't support single quote around around the fields. So you have to use double quotes. For example I have converted your curl command like appropriate one.

curl -XPOST "http://localhost:9200/indexname/typename/optionalUniqueId" -d "{ \"field\" : \"value\"}"

这篇关于如何在弹性搜索中插入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆