question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Index Lifecycle Policy max_size results in 'unit is missing' error

See original GitHub issue

NEST/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:

  1. MaxSize accepts a string parameter (which includes a unit) instead of a long?
  2. MaximumDocuments and MaximumSize naming is not consistent with MaxSize and MaxDocs

Of course the first point is the main issue here, a long seems not accepted at all by ES?

Steps to reproduce:

  1. 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:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
codebraincommented, May 30, 2019

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!

1reaction
octocat-monacommented, May 29, 2019

@codebrain Thanks, it works fine now!

Any reason you created a new method MaximumSizeAsString instead of an overload for MaximumSize?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found