Index mapping request in ElasticSearch using NEST in C#

I need to create an index with mapping using a json string provided from the input. I am trying to pass the json mapping string in a lowlevel client since my usecase has a long list of mappings which I can not do using a high-level client. However, it is creating a null mapping with the lowlevel client I am using. Below is a simple example of my mapping json string.

mappingString = {
"mappings" : {  
"exchangeid" : {
          "type" : "double"
        }
}

Below is the code snippet which I am using to create an index and then lowlevel request to create the mapping.

        CreateIndexResponse createIndexResponse = ElasticAccessor.Client.Indices.Create(IndexName, c => c
        .InitializeUsing(indexConfig));

        // Put mapping request
        StringResponse putMappingRequest = ElasticAccessor.Client.LowLevel.DoRequest<StringResponse>(HttpMethod.PUT, 
            "/" + IndexName + "/_mapping", 
            PostData.String(this.mappingString));

Any help or suggestion is greatly appreciated.



from Recent Questions - Stack Overflow https://ift.tt/3nChSkX
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation