Skip to content

Can not create index with custom analyzer #6739

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

Closed
Wertual08 opened this issue Oct 11, 2022 · 1 comment · Fixed by #6779
Closed

Can not create index with custom analyzer #6739

Wertual08 opened this issue Oct 11, 2022 · 1 comment · Fixed by #6779
Labels
8.x Relates to a 8.x client version
Milestone

Comments

@Wertual08
Copy link

Elastic.Clients.Elasticsearch version: 8.0.0-beta.6

Elasticsearch version: 8.2.3

.NET runtime version: Microsoft (R) Build Engine version 17.2.0-preview-22126-01+40f49cd8d for .NET

Operating system version: Windows 11

Description of the problem including expected versus actual behavior:
When I try to create index with

var properties = new Properties {
    { "id", new LongNumberProperty() },
    { "access_level", new IntegerNumberProperty() },
    { "name", new TextProperty { Analyzer = "simple" } },
    { "description", new TextProperty() },
    { "country", new TextProperty { Analyzer = "simple" } },
    { "city", new TextProperty { Analyzer = "simple" } },
    { "subscriptions_count", new IntegerNumberProperty() },
    { "subscribers_count", new IntegerNumberProperty() },
};
client.Indices.CreateAsync(indexName, i => i
    .Mappings(m => m
        .Properties(properties)
        .Dynamic(DynamicMapping.Strict)
    )
    .Settings(s => s
         .Analysis(a => a
             .Analyzer(a => a
                 .Custom("whitespace_lowercase", wl => wl
                     .Tokenizer("whitespace")
                     .Filter(Enumerable.Repeat("lowercase", 1))
                 )
             )
         )
     )
);

I get an exception: illegal_argument_exception Reason: "Custom Analyzer [whitespace_lowercase] must be configured with a tokenizer"

Expected behavior
Index is created

@Wertual08 Wertual08 added the 8.x Relates to a 8.x client version label Oct 11, 2022
@stevejgordon
Copy link
Contributor

stevejgordon commented Oct 12, 2022

Thanks for raising this @Wertual08. There are some issues with the settings code-gen right now, which I plan to review. This looks to be one we need to focus on, so I'll prioritise this for further review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.x Relates to a 8.x client version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants