Gop*_*pal 9 elasticsearch elasticsearch-plugin
我已经安装了 elasticsearch 版本2.3.2。我必须添加index和type到弹性搜索。在我使用 sense 插件来实现这一点之前。但是该插件已从网上商店中删除。请给出建议。
Sense 插件现在是 Kibana 应用程序。安装请参考官方参考。
您的问题的答案是,您可以通过运行以下 curl 命令来创建索引并在 Elasticsearch 中键入
curl -XPUT "http://localhost:9200/IndexName/TypeName"
Run Code Online (Sandbox Code Playgroud)
Elasticsearch 中的所有操作都可以通过 REST API 调用来完成。
要创建索引,请使用 index API
curl -XPUT 'localhost:9200/twitter?pretty' -H 'Content-Type: application/json' -d'{"settings" : {"index" : {"number_of_shards" : 3, "number_of_replicas" : 0 }}}'
Run Code Online (Sandbox Code Playgroud)
要创建映射,您可以使用_mapping端点 -
curl -XPUT http://localhost:9200/twitter/tweets/_mapping -d @"create_p4_schema_payload.json"
Run Code Online (Sandbox Code Playgroud)
在这里,映射是通过create_p4_schema_payload.json包含以下内容的 json 文件名提供的 -
{
"properties": {
"user_name": {
"type": "text"
}
}
}
Run Code Online (Sandbox Code Playgroud)
所有这些都可以通过任何支持 curl 的终端运行。对于 Windows,您可以安装cygwin以从命令提示符运行 linux 命令。
您可以使用像邮递员这样的 Rest 客户端来执行此操作。您可以将邮递员作为 chrome 扩展。
另一种方法是对集群中的一个节点执行 SSH,并使用 CURL 运行 POST 命令。
`curl -X POST 'localhost:9200/bookindex/books' -H 'Content-Type: application/json' -d'
{
"bookId" : "A00-3",
"author" : "Sankaran",
"publisher" : "Mcgrahill",
"name" : "how to get a job"
}'
Run Code Online (Sandbox Code Playgroud)
我将自动创建一个名为“bookindex”、类型为“books”的索引并索引数据。如果索引和类型已经存在,它会将条目添加到索引中。