0

I use Nest Client for creating mapping and indexing data to Elasticsearch. I am facing now a problem which I don't understand how it comes.

I use AutoMap() for mapping the object structure to index

var esClient = _esClientProvider.GetClient();
var response = esClient.Indices.Create(index,
        index => index
        .Settings(s => s.Setting("index.mapping.total_fields.limit", 2000))
        .Map<EsProduct>(
            x => x.AutoMap()
        ));

If I don't use Enabled=false annotation in the class

public string AssetType { get; set; }

There will be 2 fields generated in the index (one with text and one with keyword)

Keyword

I would like to remove the .keyword field so I use Enabled=false annotation

[Object(Enabled = false)]
public string AssetType { get; set; }

Then now there will be 2 other fields generated in the index (one with keyword and one with integer) and with different name.

Chars and Length

I don't get the point now. I just want to skip ".keyword" field and keep the text field. Is Enabled=false not the correct solution?

Thank you in advance.

Ivan Gechev
  • 706
  • 3
  • 9
  • 21
hintdesk
  • 1
  • 1
  • I found out how to skip the .keyword Field. I have to explicitly set the data type in the property [Text] public string AssetType { get; set; } – hintdesk Jun 12 '23 at 09:23

0 Answers0