Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unable to set slices to auto in .Net Opensearch client #550

Closed
goldenc opened this issue Feb 22, 2024 · 2 comments · Fixed by #553
Closed

[BUG] Unable to set slices to auto in .Net Opensearch client #550

goldenc opened this issue Feb 22, 2024 · 2 comments · Fixed by #553
Labels
bug Something isn't working

Comments

@goldenc
Copy link

goldenc commented Feb 22, 2024

What is the bug?

When doing a reindex I want to set slices to auto but the api only allows me to set a nullable long

///<summary>The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`.</summary>
		public long? Slices
		{
			get => Q<long? >("slices");
			set => Q("slices", value);
		}

How can one reproduce the bug?

Try and reindex with slices set to auto with the Opensearch .net client (1.6.0)

What is the expected behavior?

Be able to specify auto slices

What is your host/environment?

Linux

Do you have any screenshots?

No

Do you have any additional context?

@goldenc goldenc added bug Something isn't working untriaged labels Feb 22, 2024
@Xtansia Xtansia removed the untriaged label Feb 22, 2024
@Xtansia
Copy link
Collaborator

Xtansia commented Feb 22, 2024

Hi @goldenc,

Thank you for reporting this! It appears that when the client code was generated the spec used only specified slices as an integer, not that it also accepts the string auto. I will look into a good way to represent this and make a bugfix.

In the meantime you should be able to work around this by taking advantage of the "raw" request methods:

var response = await client.Http.PostAsync<ReindexOnServerResponse>(
            "/_reindex",
            d => d
                .SerializableBody(new
                {
                    source = new
                    {
                        index = "source-index"
                    },
                    dest = new
                    {
                        index = "dest-index"
                    }
                })
                .QueryString(qs => qs.Add("slices", "auto")));

@goldenc
Copy link
Author

goldenc commented Feb 23, 2024

ok, thanks for the workaround 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants