ES(1):_source元数据返回

吃可爱长大的小学妹 提交于 2020-03-09 18:17:04

1.添加测试数据

PUT /test_index/test_type/1
{
  "test_content1":"my field1",
  "test_content2":"my field2"
}

2.获取返回结果

GET /test_index/test_type/1

结果

{
  "_index": "test_index",
  "_type": "test_type",
  "_id": "1",
  "_version": 2,
  "found": true,
  "_source": {
    "test_content1": "my field1",
    "test_content2": "my field2"
  }
}

3.通过指定参数返回相应内容 参数可以以逗号分隔

GET /test_index/test_type/1?_source=test_content1
结果
{
  "_index": "test_index",
  "_type": "test_type",
  "_id": "1",
  "_version": 2,
  "found": true,
  "_source": {
    "test_content1": "my field1"
  }
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!