public void processXContentQueryParser(
     String name, Class<? extends QueryParser> xcontentQueryParser) {
   if (!groupSettings.containsKey(name)) {
     binder
         .addBinding(name)
         .toProvider(FactoryProvider.newFactory(QueryParserFactory.class, xcontentQueryParser))
         .in(Scopes.SINGLETON);
   }
 }
  @Override
  protected void configure() {

    bind(IndexQueryParserService.class).asEagerSingleton();

    // handle XContenQueryParsers
    MapBinder<String, QueryParserFactory> queryBinder =
        MapBinder.newMapBinder(binder(), String.class, QueryParserFactory.class);
    Map<String, Settings> xContentQueryParserGroups =
        settings.getGroups(IndexQueryParserService.Defaults.QUERY_PREFIX);
    for (Map.Entry<String, Settings> entry : xContentQueryParserGroups.entrySet()) {
      String qName = entry.getKey();
      Settings qSettings = entry.getValue();
      Class<? extends QueryParser> type = qSettings.getAsClass("type", null);
      if (type == null) {
        throw new IllegalArgumentException(
            "Query Parser [" + qName + "] must be provided with a type");
      }
      queryBinder
          .addBinding(qName)
          .toProvider(
              FactoryProvider.newFactory(
                  QueryParserFactory.class, qSettings.getAsClass("type", null)))
          .in(Scopes.SINGLETON);
    }

    QueryParsersProcessor.XContentQueryParsersBindings xContentQueryParsersBindings =
        new QueryParsersProcessor.XContentQueryParsersBindings(
            queryBinder, xContentQueryParserGroups);
    for (QueryParsersProcessor processor : processors) {
      processor.processXContentQueryParsers(xContentQueryParsersBindings);
    }

    for (Map.Entry<String, Class<? extends QueryParser>> entry : queries.entrySet()) {
      queryBinder
          .addBinding(entry.getKey())
          .toProvider(FactoryProvider.newFactory(QueryParserFactory.class, entry.getValue()))
          .in(Scopes.SINGLETON);
    }

    // handle XContentFilterParsers
    MapBinder<String, FilterParserFactory> filterBinder =
        MapBinder.newMapBinder(binder(), String.class, FilterParserFactory.class);
    Map<String, Settings> xContentFilterParserGroups =
        settings.getGroups(IndexQueryParserService.Defaults.FILTER_PREFIX);
    for (Map.Entry<String, Settings> entry : xContentFilterParserGroups.entrySet()) {
      String fName = entry.getKey();
      Settings fSettings = entry.getValue();
      Class<? extends FilterParser> type = fSettings.getAsClass("type", null);
      if (type == null) {
        throw new IllegalArgumentException(
            "Filter Parser [" + fName + "] must be provided with a type");
      }
      filterBinder
          .addBinding(fName)
          .toProvider(
              FactoryProvider.newFactory(
                  FilterParserFactory.class, fSettings.getAsClass("type", null)))
          .in(Scopes.SINGLETON);
    }

    QueryParsersProcessor.XContentFilterParsersBindings xContentFilterParsersBindings =
        new QueryParsersProcessor.XContentFilterParsersBindings(
            filterBinder, xContentFilterParserGroups);
    for (QueryParsersProcessor processor : processors) {
      processor.processXContentFilterParsers(xContentFilterParsersBindings);
    }

    for (Map.Entry<String, Class<? extends FilterParser>> entry : filters.entrySet()) {
      filterBinder
          .addBinding(entry.getKey())
          .toProvider(FactoryProvider.newFactory(FilterParserFactory.class, entry.getValue()))
          .in(Scopes.SINGLETON);
    }
  }