软件版本;7.3.2
运行环境;linux
场景/上下文;当使用post方式,插入一个数据,es会为我们生成id,请问id是在哪一步创建的?是在协调节点,master节点,还是?
有用的信息(请使用代码块粘贴,以方便他人查看);
相关查询请求;
错误日志;
代码块;
运行环境;linux
场景/上下文;当使用post方式,插入一个数据,es会为我们生成id,请问id是在哪一步创建的?是在协调节点,master节点,还是?
POST /website/blog/
{ "title": "My second blog entry", "text": "Still trying this out...", "date": "2014/01/01" }
有用的信息(请使用代码块粘贴,以方便他人查看);
相关查询请求;
错误日志;
代码块;
1 个回复
Charele - Cisco4321
赞同来自:
if (id == null) { //如果没有指定id
String uid;
if (indexCreatedVersion.onOrAfter(Version.V_6_0_0_beta1)) {
uid = UUIDs.base64UUID();
} else {
uid = UUIDs.legacyBase64UUID();
}
id(uid); //设置上面随机产生的id
这里的操作是在协调节点上执行的,就是说你程序连的那个节点(不管它是不是master)