当前位置: 首页 > news >正文

es添加索引命令行和浏览器添加索引--图文详解

一、添加索引

创建索引

curl -X PUT "localhost:9200/my-index-00001?pretty"

 

获取索引

curl -X GET "localhost:9200/my-index-000001?pretty"

获取全部的索引

curl -X GET "http://localhost:9200/_cat/indices?v"

获取索引映射 

curl -X GET "localhost:9200/my-index-000001/_mapping?pretty"
删除索引
curl -X DELETE "localhost:9200/my-index-000001?pretty"

添加映射:

浏览器里执行

PUT /my-index-000001/_mapping
{"properties": {"ip": {"type": "text","fields": {"keyword": {"type": "keyword","ignore_above": 256}}}}
}

 命令行执行

curl -XPUT "http://localhost:9200/my-index-000001/_mapping" -H 'Content-Type: application/json' -d'{  "properties": {     "ip": {          "type": "text",          "fields": {            "keyword": {              "type": "keyword",              "ignore_above": 256            }          }        }  }}'

 

 

重启客户端(这里用的是canal客户端,同步的mysql数据库)

 导入数据

curl -X POST  http://127.0.0.1:8081/etl/es7/mytest_user.yml

 这是我的安装目录:

配置:      /www/canal/adapter/conf/es7/mytest_user.yml

dataSourceKey: defaultDS
destination: example
groupId: g1
esMapping:_index: my-index-000001_id: _id
#  upsert: true
#  pk: idsql: "select a.id as _id,a.id from t_data_order202306 a"
#  objFields:
#    _labels: array:;etlCondition: "where a.id>={}"commitBatch: 3000 

 

 

查询数据

 浏览器查询:

GET /my-index-000001/_search
{"query": {"match": {"id": "0000391d-7907-4491-907f-9ebe9d71ab3f"}}
}

命令行查询:

curl -XGET "http://localhost:9200/my-index-000001/_search" -H 'Content-Type: application/json' -d'{  "query": {    "match": {      "id": "0000391d-7907-4491-907f-9ebe9d71ab3f"    }  }}'

 

 

http://www.lryc.cn/news/97258.html

相关文章:

  • Java 大数字运算之 BigDecimal 类
  • MySQL 8.0 OCP (1Z0-908) 考点精析-架构考点1:二进制日志文件(Binary log)
  • MY.CNF
  • SpringBoot IOC与AOP(一)
  • JVM运行时数据区——方法区的垃圾回收
  • LeetCode213.House-Robber-II<打家劫舍II>
  • 订单系统问题汇总
  • springboot热加载spring-boot-devtools:
  • QT学习之旅 - 一个QT的基本项目
  • 大数据课程D2——hadoop的概述
  • 使用nginx和ffmpeg搭建HTTP FLV流媒体服务器(摄像头RTSP视频流->RTMP->http-flv)
  • 揭秘APT团体常用的秘密武器——AsyncRAT
  • Flutter Widget Life Cycle 组件生命周期
  • LeetCode面向运气之Javascript—第2600题-K件物品的最大和-94.68%
  • 数学建模学习(4):TOPSIS 综合评价模型及编程实战
  • PHP之Smarty使用以及框架display和assign原理
  • 《TCP IP网络编程》第十一章
  • Folx Pro 5 最好用的Mac磁力链接BT种子下载工具
  • Redis 数据库的高可用
  • elementPlus dialog组件设置可拖动,当内容高度大于视口高度拖动显示异常的解决办法
  • 亲测解决Git inflate: data stream error (incorrect data check)
  • Ansible 自动化运维工具
  • node.js 爬虫图片下载
  • VAE-根据李宏毅视频总结的最通俗理解
  • 【LangChain】检索器之上下文压缩
  • uniapp 语音文本播报功能
  • 腾讯云高IO型云服务器CPU型号处理器主频性能
  • 【数据结构】实验八:树
  • kafka消费者api和分区分配和offset消费
  • 【驱动开发day4作业】