面试题答案
一键面试在Elasticsearch的MGet API中,可通过_source
参数指定想要获取的部分特定存储字段。
常见请求格式如下:
POST /_mget
{
"docs": [
{
"_index": "your_index",
"_id": "your_id",
"_source": ["field1", "field2"]
},
{
"_index": "another_index",
"_id": "another_id",
"_source": ["field3"]
}
]
}
参数含义:
_index
:指定文档所在的索引。_id
:指定文档的唯一标识符。_source
:一个数组,数组元素为想要获取的字段名,用于指定只获取这些特定字段的数据。