Create a mapping from the JSON File to the index

I want to define the mapping of the index in the JSON file. I am searching for using the proper NEST command to create an index by reading that file.
I came across using the PostData and PUT commands, but quite not sure on how to develop on it.
I am using Elasticsearch.Net and NEST: the .NET clients [5.5] documentation to follow up on these.

I was using the below code to create index and do mapping. But now it doesn't work for the search bar properly.

public static void InitCredential()
{

        if ( !EC.IndexExists( CredentialIndex ).Exists )
        {
            // .String(s => s.Index(FieldIndexOption.NotAnalyzed).Name(n => n.Name))
            EC.CreateIndex( CredentialIndex, c => new CreateIndexDescriptor( CredentialIndex )
                .Mappings( ms => ms
                    .Map<CredentialIndex>( m => m
                        .AutoMap()
                        .Properties( p => p
                          .Text( s => s.Index( true ).Name( n => n.Name ).Fielddata( true ) )
                            .Nested<IndexSubject>( n => n
                                .Name( nn => nn.Subjects )
                                .AutoMap()
                            )
                           .Nested<IndexReferenceFramework>( n => n
                                .Name( nn => nn.Frameworks )
                                .AutoMap()
                            )
                            .Nested<IndexCompetency>( n => n
                                .Name( nn => nn.Competencies )
                                .AutoMap()
                            )
                             //.GeoPoint( g => g.Name( n => n.AddressLocations ) )
                             .Nested<Models.Elastic.Address>( n => n
                                .Name( nn => nn.Addresses )
                                .AutoMap()
                            )
                        )
                    )
                )
            );
        }
    }

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.