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 ...
随机推荐
- P3008 [USACO11JAN]道路和飞机Roads and Planes
P3008 [USACO11JAN]道路和飞机Roads and Planes Dijkstra+Tarjan 因为题目有特殊限制所以不用担心负权的问题 但是朴素的Dijkstra就算用堆优化,也显然 ...
- shell下如何删除文件的某一列
答:cat file | awk '{$1=null;print $0}' (删除第一列)
- java Request 获得用户IP地址
public static String getIpAddress(HttpServletRequest request) { String ip = request.getHeader(" ...
- vuejs全局api概念
什么是全局API? 全局API并不在构造器里,而是先声明全局变量或者直接在Vue上定义一些新功能,Vue内置了一些全局API,比如我们今天要学习的指令Vue.directive.说的简单些就是,在构造 ...
- Python matplot画散列图
同matlab一样,matplot也可画散列图scatter. import numpy as np import matplotlib.pyplot as plt #fig = plt.figure ...
- python 多线程队列
##Using Queue with multiprocessing – Chapter : Process Based Parallelism import multiprocessing impo ...
- c++ 容器元素遍历打印(for_each)
#include <iostream> // cout #include <algorithm> // for_each #include <vector> // ...
- docker 出现 Error response from daemon
第一步:通过dig @114.114.114.114 registry-1.docker.io找到可用IP navy@deepin:~/Desktop$ dig @.docker.io ; <& ...
- 用docker部署flask+gunicorn+nginx
说来惭愧,写了好几个flask django项目都是在原型阶段直接python app.py 运行的,涉及到部署用nginx和gunicorn 都是让别人帮我部署的,据说好像说很麻烦的样子,我就没自己 ...
- Codeforces 918C - The Monster
918C - The Monster 思路1: 右键在新窗口打开图片 代码: #include<bits/stdc++.h> using namespace std; #define ll ...