Elasticsearch之curl创建索引库
关于curl的介绍,请移步
Elasticsearch学习概念之curl
启动es,请移步
Elasticsearch的前后台运行与停止(tar包方式)
Elasticsearch的前后台运行与停止(rpm包方式)
创建索引库,我这里命名为zhouls


[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://192.168.80.200:9200/zhouls'
{"acknowledged":true}[hadoop@djt002 elasticsearch-2.4.3]$
这里,是跟之前的elasticsearch.yml修改对应起来的。

我们可以验证下,输入localhost或者127.0.0.1都会出现无法连接,不信你尝试。

[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://192.168.80.200:9200/zhouls'
{"acknowledged":true}[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://localhost:9200/zhouls'
curl: (7) couldn't connect to host
[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://127.0.0.1:9200/zhouls'
curl: (7) couldn't connect to host
[hadoop@djt002 elasticsearch-2.4.3]$
为了方便,更改为0.0.0.0

然后,重启es

[hadoop@djt002 elasticsearch-2.4.3]$ jps
2811 Jps
2741 Elasticsearch
[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://localhost:9200/zhouls'
{"error":{"root_cause":[{"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"}],"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"},"status":400}[hadoop@djt002 elasticurl -XPUT 'http://127.0.0.1:9200/zhouls'
{"error":{"root_cause":[{"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"}],"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"},"status":400}[hadoop@djt002 elasticurl -XPUT 'http://192.168.80.200:9200/zhouls'
{"error":{"root_cause":[{"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"}],"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"},"status":400}[hadoop@djt002 elasticsearch-2.4.3]$
报这个错误,是正常的,因为,你重复创建索引库。根据经验之谈,一般用内网ip。如我的192.168.80.200。建议指定内网ip
本地回环地址:127.0.0.1
内网地址:192.168.80.200
外网地址:10.29.0.2
在这里0.0.0.0 表示可以通过上面所有ip都可以访问
以上是,Elasticsearch之curl创建索引库的方式1,以下是,Elasticsearch之curl创建索引库的方式2

[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://192.168.80.200:9200/zhouls'
{"error":{"root_cause":[{"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"}],"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"},"status":400}[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPOST 'http://192.168.80.200:9200/zhouls1'
{"acknowledged":true}[hadoop@djt002 elasticsearch-2.4.3]$
测试完,及时删除。

[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://192.168.80.200:9200/zhouls'
{"error":{"root_cause":[{"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"}],"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"},"status":400}[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPOST 'http://192.168.80.200:9200/zhouls1'
{"acknowledged":true}[hadoop@djt002 elasticsearch-2.4.3]$ curl -XDELETE 'http://192.168.80.200:9200/zhouls1'
{"acknowledged":true}[hadoop@djt002 elasticsearch-2.4.3]$
Elasticsearch之curl创建索引库的更多相关文章
- Elasticsearch之curl创建索引库和索引时注意事项
前提, Elasticsearch之curl创建索引库 Elasticsearch之curl创建索引 注意事项 1.索引库名称必须要全部小写,不能以下划线开头,也不能包含逗号 2.如果没有明确指定索引 ...
- Elasticsearch之curl创建索引
前提,是 Elasticsearch之curl创建索引库 [hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://192.168.80.200: ...
- Elasticsearch之curl删除索引库
关于curl创建索引库的介绍,请移步 Elasticsearch之curl创建索引库 [hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://1 ...
- (转)ElasticSearch Java Api-检索索引库
上篇博客记录了如何用java调用api把数据写入索引,这次记录下如何搜索. 一.准备数据 String data1 = JsonUtil.model2Json(new Blog(1, "gi ...
- lucene中创建索引库
package com.hope.lucene;import org.apache.commons.io.FileUtils;import org.apache.lucene.document.Doc ...
- elasticsearch kabana中创建索引
在kabana中创建索引和索引类型语法 PUT clockin{ "mappings": { "time": { } }} 查询索引下的所有数据 GET clo ...
- Elasticsearch之cur查询索引
前提, Elasticsearch之curl创建索引库 Elasticsearch之curl创建索引 Elasticsearch之curl创建索引库和索引时注意事项 Elasticsearch之cur ...
- Elasticsearch之CURL命令的DELETE
也可以看我写的下面的博客 Elasticsearch之curl删除 Elasticsearch之curl删除索引库 删除,某一条数据,如下 [hadoop@master elasticsearch-] ...
- Elasticsearch之curl删除
扩展下, Elasticsearch之curl删除索引库 [hadoop@djt002 elasticsearch-2.4.3]$ curl -XDELETE 'http://192.168.80.2 ...
随机推荐
- zipfile.BadZipFile: File is not a zip file
zipfile.BadZipFile: File is not a zip file 出现这个问题一般是文件损坏的可能性比较大
- Kindeditor 函数用途
1.loadScript 加载文件 2.updateState 更新工具条状态 afterCreate在dom加载的时候执行,dom加载完之前执行的 K.ready dom加载完之后执行 ...
- Swift URL encode
前言 在WEB前端开发,服务器后台开发,或者是客户端开发中,对URL进行编码是一件很常见的事情,但是由于各个年代的RFC文档中的内容一直在变化,一些年代久远的代码就对URL编码和解码的规则和现在的有一 ...
- VHDL基础 学习笔记
最近一直忙着学校里的活动,所以没怎么更新,上周活动忙完了,正好也借着数电实验的机会,重新学习一下VHDL的编程.以下是转自360doc的教程: ———————————————————————————— ...
- 基于WebServices简易网络聊天工具的设计与实现
基于WebServices简易网络聊天工具的设计与实现 Copyright 朱向洋 Sunsea ALL Right Reserved 一.项目内容 本次课程实现一个类似QQ的网络聊天软件的功能:服务 ...
- mac活动监视器闪退
输入:rm -rf ~/Library/LaunchAgents/com.apple.Yahoo.plist即可!
- 剑指offer之 二叉搜索树与双向链表
class TreeNode { int val = 0; TreeNode left = null; TreeNode right = null; public TreeNode(int val) ...
- 矩阵内积和Schur补
> Many problems in the field of signal processing have been expended into matrix problems.So it's ...
- javascript中的this值
如何确定this的值 this值会被传递给所有函数,this的值是基于运行时调用函数的上下文. 例如:从全局作用域调用sayFoo函数时,this引用window对象, 当它作为myObject的一 ...
- 十二 Django框架,自定义分页
自定义分页模块 #!/usr/bin/env python #coding:utf-8 from django.utils.safestring import mark_safe #封装分页类模块 c ...