elasticsearch 自定义_id
elasticsearch 自定义ID:
curl -s -XPUT localhost:9200/web -d '
{
"mappings": {
"blog": {
"_id": {
"path": "uuid"
},
"properties": {
"title": {
"type": "string",
"index": "analyzed"
}
}
}
}
}'
启动本地es,然后写入数据,data2.json:
{ "index": { "_index": "web", "_type": "blog", "_id": "123" }}
{"title": "But we can update it" }
{ "index": { "_index": "web", "_type": "blog", "_id": "123" }}
{ "title": "But we can update it" }
{ "index": { "_index": "web", "_type": "blog"}}
{ "title": "But we can update it", "uuid": "3210"}
通过批量插入上述数据:
curl -s -XPOST localhost:9200/_bulk --data-binary @data2.json
{"took":3,"errors":false,"items":[{"index":{"_index":"web","_type":"blog","_id":"123","_version":5,"status":200}},
{"index":{"_index":"web","_type":"blog","_id":"123","_version":6,"status":200}},
{"index":{"_index":"web","_type":"blog","_id":"3210","_version":3,"status":200}}]}
可以看到新生成的文档_id为uuid的数值!
elasticsearch 自定义_id的更多相关文章
- Elasticsearch 自定义多个分析器
分析器(Analyzer) Elasticsearch 无论是内置分析器还是自定义分析器,都由三部分组成:字符过滤器(Character Filters).分词器(Tokenizer).词元过滤器(T ...
- Elasticsearch 自定义映射
尽管在很多情况下基本域数据类型 已经够用,但你经常需要为单独域自定义映射 ,特别是字符串域.自定义映射允许你执行下面的操作: 全文字符串域和精确值字符串域的区别 使用特定语言分析器 优化域以适应部分匹 ...
- ElasticSearch自定义分析器-集成结巴分词插件
关于结巴分词 ElasticSearch 插件: https://github.com/huaban/elasticsearch-analysis-jieba 该插件由huaban开发.支持Elast ...
- elasticsearch 自定义similarity 插件开发
转自:http://www.chepoo.com/elasticsearch-similarity-custom-plug-in-development.html 在搜索开发中,我们要修改打分机制,就 ...
- Elasticsearch自定义分析器
关于分析器 ES中默认使用的是标准分析器(standard analyzer).如果需要对某个字段使用其他分析器,可以在映射中该字段下说明.例如: PUT /my_index { "mapp ...
- elasticsearch自定义动态映射
https://www.elastic.co/guide/cn/elasticsearch/guide/current/custom-dynamic-mapping.html如果你想在运行时增加新的字 ...
- ElasticSearch——自定义模板
output中配置 elasticsearch{ action => "index" hosts => ["xxx"] index => &q ...
- ElasticSearch 自定义排序处理
使用function_score进行分组处理,利用分组函数script_score进行自定义分值处理, 注意:使用script功能需要在配置中打开脚本功能: script.inline: on s ...
- Elasticsearch自定义客户端(TransportClient)资源池
前言: java中调用TransportClient时,我们一般都会设置成单例,为了避免多次的创建与关闭造成的内存占用及关闭缓慢问题.而TransportClient本身也是实现了线程池threadP ...
随机推荐
- Fast特征点的寻找和提取
一.基础 最初由Rosten和Drummond [Rosten06]提出的FAST(加速段测试的特征)特征检测算法是基于将点P与其包围圆内的点集的直接比较的思想. 基本思想是,如果附近的几个点与P类似 ...
- 20145327 《网络对抗》逆向及BOF基础实践
20145327 <网络对抗>逆向及BOF基础实践 实践目标 本次实践的对象是一个名为pwn1的linux可执行文件. 该程序正常执行流程是:main调用foo函数,foo函数会简单回显任 ...
- 2017.11.11 B201 练习题思路及解题方法
2017.11.11 B201 练习题思路及解题方法 题目类型及涵盖知识点 本次总共有6道题目,都属于MISC分类的题目,涵盖的知识点有 信息隐藏 暴力破解 音轨,摩斯电码 gif修改,base64原 ...
- [算法整理]树上求LCA算法合集
1#树上倍增 以前写的博客:http://www.cnblogs.com/yyf0309/p/5972701.html 预处理时间复杂度O(nlog2n),查询O(log2n),也不算难写. 2#st ...
- DDMS files not found
在eclipse中启动新建的android项目的时候,控制台提示如图: 方法1.cmd中adb kill-server,然后adb -startserver 方法2.方法1不管用,那么在任务管理器中杀 ...
- ubuntu16.04下编译ceres-solver
一.编译环境 ubuntu16.04 二.准备工作之安装必要的库 2.1安装cmake sudo apt-get install cmake 2.2 安装google-glog + gflags su ...
- ubuntu启动google_chrome报错:FATAL:nss_util.cc(632)] NSS_VersionCheck("3.26") failed. NSS >= 3.26 is required. Please upgrade to the latest NSS
一.背景: jello@jello:~$ lsb_release -aNo LSB modules are available.Distributor ID: Ubuntu KylinDescr ...
- ACM-ICPC 2018 徐州赛区网络预赛H Ryuji doesn't want to study(树状数组)题解
题意:给你数组a,有两个操作 1 l r,计算l到r的答案:a[l]×L+a[l+1]×(L−1)+⋯+a[r−1]×2+a[r] (L is the length of [ l, r ] that ...
- 【TCP/IP协议 卷一:协议】第三章 IP:网际协议
3.1 引言 unreliable不可靠的意思是它并不能保证IP数据报能成功的到达目的地.IP只提供尽力而为的传输服务. conectionless无连接的意思是IP并不维护任何关于后续数据报的状态信 ...
- python ros 创建节点订阅robot_pose
建立文件夹hello_rospy,再在该目录下建立子目录src,cd到该src目录,运行如下命令创建工作包 catkin_create_pkg beginner_tutorials std_msgs ...