## 获取请求
```
GetRequest getRequest = new GetRequest(
"posts", // index
"1"); //document ID
```
可选参数
```
request.fetchSourceContext(FetchSourceContext.DO_NOT_FETCH_SOURCE);
```
禁用源检索,默认情况下启用,默认返回所有字段
~~~
String[] includes = new String[]{"message", "*Date"};
String[] excludes = Strings.EMPTY_ARRAY;
FetchSourceContext fetchSourceContext =
new FetchSourceContext(true, includes, excludes);
request.fetchSourceContext(fetchSourceContext);
//includes 配置返回响应包含哪些字段
//excludes 设置返回响应不包含哪些字段
~~~
设置检索哪些存储字段
```
request.storedFields("message"); ////为特定存储字段配置检索 (要求在映射中单独存储字段)
GetResponse getResponse = client.get(request, RequestOptions.DEFAULT);
String message = getResponse.getField("message").getValue();////获取message存储的值 (要求将字段单独存储在映射中)
```
设置父文档
```
request.parent("parent");
```
设置偏好
```
request.preference("preference");
```
设置实时标识,默认`true`
```
request.realtime(false);
```
设置每次获取文档之前是否执行刷新操作,默认`false`
```
request.refresh(true);
```