-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
NEST/Elasticsearch.Net version: 7.4.0
Elasticsearch version: 7.4.x
Description of the problem including expected versus actual behavior:
The .NEST client does not create valid JSON for the actions of a PutLifecycle request. If more than one action is declared, there are no commas between the actions object members.
Steps to reproduce:
- Create 7.4.0 ElasticClient
- Call PutLifeycle with at least two actions for a single lifecycle phase
var client = new ElasticClient(new ConnectionSettings(new Uri("http://localhost:9200"))
.DisableDirectStreaming());
var response = client.IndexLifecycleManagement.PutLifecycle(
"policy1",
pld => pld.Policy(pd => pd
.Phases(phasesDesc => phasesDesc
.Cold(phaseDesc => phaseDesc
.Actions(actionsDesc => actionsDesc
.Freeze(d => d)
.SetPriority(d => d.Priority(50))
)
)
)
)
);
Provide ConnectionSettings
(if relevant):
DisableDirectStreaming()
Provide DebugInformation
(if relevant):
Invalid NEST response built from a unsuccessful (400) low level call on PUT: /_ilm/policy/policy1
Audit trail of this API call:
- [1] BadResponse: Node: http://localhost:9200/ Took: 00:00:00.0059976
OriginalException: Elasticsearch.Net.ElasticsearchClientException: The remote server returned an error: (400) Bad Request.. Call: Status code 400 from: PUT /_ilm/policy/policy1. ServerError: Type: x_content_parse_exception Reason: "[1:51] [put_lifecycle_request] failed to parse field [policy]" CausedBy: "Type: x_content_parse_exception Reason: "[1:51] [lifecycle_policy] failed to parse field [phases]" CausedBy: "Type: x_content_parse_exception Reason: "[1:51] [phases] failed to parse field [cold]" CausedBy: "Type: x_content_parse_exception Reason: "[1:51] [phase] failed to parse field [actions]" CausedBy: "Type: json_parse_exception Reason: "Unexpected character ('"' (code 34)): was expecting comma to separate Object entries
at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@7750ef74; line: 1, column: 53]""""" ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
at System.Net.HttpWebRequest.GetResponse()
at Elasticsearch.Net.HttpWebRequestConnection.Request[TResponse](RequestData requestData)
--- End of inner exception stack trace ---Request:
{"policy":{"phases":{"cold":{"actions":{"freeze":{}"set_priority":{"priority":50}}}}}}
Response:
{"error":{"root_cause":[{"type":"x_content_parse_exception","reason":"[1:51] [phase] failed to parse field [actions]"}],"type":"x_content_parse_exception","reason":"[1:51] [put_lifecycle_request] failed to parse field [policy]","caused_by":{"type":"x_content_parse_exception","reason":"[1:51] [lifecycle_policy] failed to parse field [phases]","caused_by":{"type":"x_content_parse_exception","reason":"[1:51] [phases] failed to parse field [cold]","caused_by":{"type":"x_content_parse_exception","reason":"[1:51] [phase] failed to parse field [actions]","caused_by":{"type":"json_parse_exception","reason":"Unexpected character ('"' (code 34)): was expecting comma to separate Object entries\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@7750ef74; line: 1, column: 53]"}}}}},"status":400}