Skip to content

Can not create index with custom analyzer #6739

Closed
@Wertual08

Description

@Wertual08

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    8.xRelates to a 8.x client version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions