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

[IOT Lab] Suggestion: Use fluent builder pattern for indexing policy for better readability #21

Open
deborahc opened this issue Oct 20, 2019 · 0 comments

Comments

@deborahc
Copy link

The code for tuning the indexing policy may be easier to read if you use the fluent indexing policy builder:

Current code:
// Tune the indexing policy for write-heavy workloads by only including regularly queried paths.
// Be careful when using an opt-in policy as we are below. Excluding all and only including certain paths removes
// Cosmos DB's ability to proactively add new properties to the index.
telemetryContainerDefinition.IndexingPolicy.ExcludedPaths.Clear();
telemetryContainerDefinition.IndexingPolicy.ExcludedPaths.Add(new ExcludedPath { Path = "/*" }); // Exclude all paths.
telemetryContainerDefinition.IndexingPolicy.IncludedPaths.Clear();
telemetryContainerDefinition.IndexingPolicy.IncludedPaths.Add(new IncludedPath { Path = "/vin/?" });
telemetryContainerDefinition.IndexingPolicy.IncludedPaths.Add(new IncludedPath { Path = "/state/?" });
telemetryContainerDefinition.IndexingPolicy.IncludedPaths.Add(new IncludedPath { Path = "/partitionKey/?"

See example: https://gist.github.com/deborahc/57b996e5f1dd82fcc1aacf00621c2459

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant