Skip to content

Commit

Permalink
Handle null parser (#57071)
Browse files Browse the repository at this point in the history
  • Loading branch information
danhermann authored May 26, 2020
1 parent 93c557e commit b4b31ef
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ public List<Route> routes() {
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
CreateDataStreamAction.Request putDataStreamRequest = new CreateDataStreamAction.Request(request.param("name"));
request.withContentOrSourceParamParserOrNull(parser -> {
Map<String, Object> body = parser.map();
String timeStampFieldName = (String) body.get(DataStream.TIMESTAMP_FIELD_FIELD.getPreferredName());
if (timeStampFieldName != null) {
putDataStreamRequest.setTimestampFieldName(timeStampFieldName);
if (parser != null) {
Map<String, Object> body = parser.map();
String timeStampFieldName = (String) body.get(DataStream.TIMESTAMP_FIELD_FIELD.getPreferredName());
if (timeStampFieldName != null) {
putDataStreamRequest.setTimestampFieldName(timeStampFieldName);
}
}
});
return channel -> client.admin().indices().createDataStream(putDataStreamRequest, new RestToXContentListener<>(channel));
Expand Down

0 comments on commit b4b31ef

Please sign in to comment.