Interface AnalysisPlugin


  • public interface AnalysisPlugin
    An additional extension point for Plugins that extends Elasticsearch's analysis functionality. To add an additional TokenFilter just implement the interface and implement the getTokenFilters() method:
    
     public class AnalysisPhoneticPlugin extends Plugin implements AnalysisPlugin {
         @Override
         public Map<String, AnalysisProvider<TokenFilterFactory>> getTokenFilters() {
             return singletonMap("phonetic", PhoneticTokenFilterFactory::new);
         }
     }
     
    Elasticsearch doesn't have any automatic mechanism to share these components between indexes. If any component is heavy enough to warrant such sharing then it is the Plugin's responsibility to do it in their AnalysisModule.AnalysisProvider implementation. We recommend against doing this unless absolutely necessary because it can be difficult to get the caching right given things like behavior changes across versions.