You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
status: 400, type: parsing_exception, reason: Failed to parse object: expecting token of type [START_OBJECT] but found [START_ARRAY], root_cause: [{parsing_exception Failed to parse object: expecting token of type [START_OBJECT] but found [START_ARRAY] }]
Simple fix here is to change from Conditions []struct { to Conditions struct {. But, the inline struct type declaration is not user friendly. Better solution is to create a type for Conditions such as:
// PolicyStateTransitionCondition is a sub type of PolicyStateTransition containing conditions for a transition
type PolicyStateTransitionCondition struct {
MinIndexAge string `json:"min_index_age,omitempty"`
MinRolloverAge string `json:"min_rollover_age,omitempty"`
MinDocCount int `json:"min_doc_count,omitempty"`
MinSize string `json:"min_size,omitempty"`
Cron *PolicyStateTransitionConditionCron `json:"cron,omitempty"`
}
type PolicyStateTransitionConditionCron struct {
Expression string `json:"expression"`
Timezone string `json:"timezone"`
}
// PolicyStateTransition is a sub type of PolicyState containing information about transition to other states
type PolicyStateTransition struct {
StateName string `json:"state_name"`
Conditions *PolicyStateTransitionCondition `json:"conditions"`
}
The text was updated successfully, but these errors were encountered:
* fixes Conditions in PolicyStateTransition of ISM plugin
Signed-off-by: Erik Tammaru <etammaru@miteksystems.com>
* update CHANGELOG
Signed-off-by: Erik Tammaru <etammaru@miteksystems.com>
* add comment for exported type
Signed-off-by: Erik Tammaru <etammaru@miteksystems.com>
---------
Signed-off-by: Erik Tammaru <etammaru@miteksystems.com>
Co-authored-by: Erik Tammaru <etammaru@miteksystems.com>
The following
Conditions
struct is invalid and causes a 400 error to be returned by opensearch when a value is supplied:opensearch-go/plugins/ism/api_policies.go
Lines 252 to 260 in d3be0e9
Reason being, it should be a single object, not an array of objects -- see here for example: https://opensearch.org/docs/2.14/im-plugin/ism/api/#create-policy
Here's an example request to reproduce the error:
Causes the error:
status: 400, type: parsing_exception, reason: Failed to parse object: expecting token of type [START_OBJECT] but found [START_ARRAY], root_cause: [{parsing_exception Failed to parse object: expecting token of type [START_OBJECT] but found [START_ARRAY] }]
Simple fix here is to change from
Conditions []struct {
toConditions struct {
. But, the inline struct type declaration is not user friendly. Better solution is to create a type forConditions
such as:The text was updated successfully, but these errors were encountered: