static bool CreatIndex(IElasticClient client) { return(client.CreateIndexIfNotExists(UserMessageBoxRelationIndex, c => c.Settings(_ => _.NumberOfShards(20).NumberOfReplicas(1)) .Mappings(cm => cm .Map <UserMessageBoxInfoRelationC>(m => m .RoutingField(mr => mr.Required()) .SourceField(ms => ms.Enabled(false)) .AutoMap())))); }