Index name prefix/suffix


#1

Hi, I would like to use NEST and have my index names automatically prefixed with something like "dev_" for handling different environments.
Is there a way to do this directly in NEST through some kind of hook or connection handler etc.?


(Martijn Laarman) #2

You can use the following:

var settings = new ConnectionSettings()
   .InferMappingFor<Project>(m=>m
   	.IndexName(GetEnvironmentPrefix() + "project")
   ); 

GetEnvironmentPrefix() would yield the correct prefix based on where its running.


(system) #3

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