Index Lifecycle Policy max_size results in 'unit is missing' error
See original GitHub issueNEST/Elasticsearch.Net version: 6.7.0
Elasticsearch version: 6.7.1
Description of the problem including expected versus actual behavior:
Creating an ILM policy with a rollover max_size
field gives an unit is missing or unrecognized
error.
Compared to the RolloverIndexAsync
there are a few differences:
MaxSize
accepts a string parameter (which includes a unit) instead of along?
MaximumDocuments
andMaximumSize
naming is not consistent withMaxSize
andMaxDocs
Of course the first point is the main issue here, a long
seems not accepted at all by ES?
Steps to reproduce:
- Create policy:
await _client.PutLifecycleAsync("my-policy", descriptor => descriptor
.Policy(policy => policy
.Phases(phases => phases
.Hot(hot => hot
.Actions(actions => actions
.Rollover(rollover => rollover
.MaximumDocuments(1_000_000)
.MaximumSize(40_000_000_000)// Note the size type is 'long?'
)
)
)
)
)
);
// Compared to Rollover:
/*await _client.RolloverIndexAsync("my-alias", d => d
.Conditions(c => c
.MaxDocs(1_000_000)
.MaxSize("40gb")// Note the size type is 'string'
)
);*/
Which results in http call:
PUT _ilm/policy/my-policy
{
"policy": {
"phases": {
"hot": {
"actions": {
"rollover": {
"max_docs": 1000000,
"max_size": 40000000000
}
}
}
}
}
}
This will return a 400 error:
{
"error": {
"root_cause": [{
"type": "parse_exception",
"reason": "failed to parse setting [max_size] with value [40000000000] as a size in bytes: unit is missing or unrecognized"
}
],
"type": "x_content_parse_exception",
"reason": "[8:19] [put_lifecycle_request] failed to parse field [policy]",
"caused_by": {
"type": "x_content_parse_exception",
"reason": "[8:19] [lifecycle_policy] failed to parse field [phases]",
"caused_by": {
"type": "x_content_parse_exception",
"reason": "[8:19] [phases] failed to parse field [hot]",
"caused_by": {
"type": "x_content_parse_exception",
"reason": "[8:19] [phase] failed to parse field [actions]",
"caused_by": {
"type": "x_content_parse_exception",
"reason": "[8:19] [actions] failed to parse field [rollover]",
"caused_by": {
"type": "x_content_parse_exception",
"reason": "[8:19] [rollover] failed to parse field [max_size]",
"caused_by": {
"type": "parse_exception",
"reason": "failed to parse setting [max_size] with value [40000000000] as a size in bytes: unit is missing or unrecognized"
}
}
}
}
}
}
},
"status": 400
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Troubleshooting index lifecycle management errors
This indicates that the cluster is running out of disk space. This can happen when you don't have index lifecycle management set up...
Read more >elastic lifecycle policy is lost when the index rotates
The problem is that you don't have any _index_template or a _template . I recommend you use datastream indices. Here is a good...
Read more >API Documentation - Python Elasticsearch Client
Parameters: body – A query to restrict the results specified with the Query DSL (optional); index – A comma-separated list of indices to ......
Read more >Troubleshooting Amazon OpenSearch Service
Learn how to identify and solve common Amazon OpenSearch Service errors.
Read more >Elasticsearch Log Errors
Opster error repository includes examples, best practices, common problems, tips and various material to help solve Elasticsearch issues.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It was to maintain binary compatibility - we had a debate about what to do in this instance, as technically we are fixing a bug, but to add
AsString
as the suffix is a common pattern already in the codebase.Happy that this has fixed the issue for you, I will close this ticket now.
Thanks!
@codebrain Thanks, it works fine now!
Any reason you created a new method
MaximumSizeAsString
instead of an overload forMaximumSize
?