Uploaded image for project: 'Hibernate Search'
  1. HSEARCH-3521

Move index-specific configuration properties below the hibernate.search.backends.<backend name>.indexes property

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0.0.Alpha4
    • Component/s: engine
    • Labels:
      None

      Description

      Suggested by Guillaume Smet

      Instead of having this:

      hibernate.search.default_backend es
      hibernate.search.backends.es.type elasticsearch
      hibernate.search.backends.es.index_defaults.foo bar
      hibernate.search.indexes.Book.foo bar2
      

      We would have this:

      hibernate.search.default_backend es
      hibernate.search.backends.es.type elasticsearch
      hibernate.search.backends.es.index_defaults.foo bar
      hibernate.search.backends.es.indexes.Book.foo bar2
      

      Which makes more sense, since the options available to configure the index "Book" actually depend on the backend in which this index is defined.

      As a bonus it also feels more "tidy" since the index properties are nested under the right backend. It's particularly visible in a YAML configuration, like in Spring Boot:

      spring.jpa.properties:
          hibernate.search:
              default_backend: es
              backends.es:
                  type: elasticsearch
                  index_defaults:
                      foo: bar
                  indexes.Book:
                      foo: bar2
      

      However, in order for this to be possible, we will need to change how we configure an index to point to a certain backend. Currently this is done in the configuration:

      hibernate.search.backends.es.type elasticsearch
      hibernate.search.backends.lucene.type lucene
      
      hibernate.search.default_backend es
      
      # Override the default
      hibernate.search.indexes.Book.backend lucene
      

      Which obviously makes no sense if the index properties are nested under the backend name.

      One solution would be to configure the targeted backend in the mapper:

      @Indexed(backend = "lucene") // New attribute
      public class Book {
      ... 
      }
      

      The default (when the "backend" attribute is not defined) being to rely on hibernate.search.default_backend.

        Attachments

          Activity

            People

            • Assignee:
              yrodiere Yoann Rodière
              Reporter:
              yrodiere Yoann Rodière
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: