首页 > 其他 > 详细

es 返回定制化的_source数据

时间:2019-09-21 15:04:55      阅读:157      评论:0      收藏:0      [点我收藏+]

1、_source元数据

put /test_index/test_type/1
{
"test_field1": "test field1",
"test_field2": "test field2"
}

get /test_index/test_type/1

{
"_index": "test_index",
"_type": "test_type",
"_id": "1",
"_version": 2,
"found": true,
"_source": {
"test_field1": "test field1",
"test_field2": "test field2"
}
}

_source元数据:就是说,我们在创建一个document的时候,使用的那个放在request body中的json串,默认情况下,在get的时候,会原封不动的给我们返回回来。

------------------------------------------------------------------------------------------------------------------

2、定制返回结果

定制返回的结果,指定_source中,返回哪些field

GET /test_index/test_type/1?_source=test_field1,test_field2

{
"_index": "test_index",
"_type": "test_type",
"_id": "1",
"_version": 2,
"found": true,
"_source": {
"test_field2": "test field2"
}
}

es 返回定制化的_source数据

原文:https://www.cnblogs.com/siye1989/p/11562085.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!