Search code examples
phpsymfonyyamlfoselasticabundle

FOS ElasticaSearch Unrecognized options index_analyzer search_analyzer mappings


I'm blocked by Symfony error:

Unrecognized options "index_analyzer, search_analyzer, mappings" under "fos_elastica.indexes.optro.types.technical_assistance"

I use Symfony 3.4.11 and FOS-ElasticSearch 5.03.

What's wrong? File indentation?
Part of Config file:

types:
  technical_assistance:
    index_analyzer: my_nGram_index_analyzer
    search_analyzer: my_nGram_search_analyzer
    mappings:
      subject: { boost: 2 }
      description: ~
      equipment_reference: ~
      filename: ~
      trackingNumber: ~
      requester:
        type: "object"
        properties:
          first_name: ~
          last_name: ~
      section:
        type: "object"
        properties:
          name: ~
          translatedNames: ~
      messages:
        type: "object"
        properties:
          content: { boost: 0.5 }
          filename: ~
    persistence:
      driver: orm
      model: Optro\HelpdeskBundle\Entity\TechnicalAssistance
      provider: ~
      listener: ~
      finder:
        service: optro.finder.raw.technical_assistance

Solution

  • Your custom analyzer has to be declared for each relevant fields. As far as i know, you can't declared it globally.

    types:
        technical_assistance:
             properties:
                 subject:
                     boost: 2
                     index_analyzer: my_nGram_index_analyzer
                     search_analyzer: my_nGram_search_analyzer
                 description:
                     index_analyzer: my_nGram_index_analyzer
                     search_analyzer: my_nGram_search_analyzer
                 ...