4

I am busy implementing elasticsearch for a customer project. Elasticsearch seems pretty powerful and has a neat API.

Integrated with FOSElasticaBundle i have the following configuration:

fos_elastica:
clients:
    default:
        host: localhost
        port: 9200
indexes:
    app:
        client: default
        settings:
            index:
                analysis:
                    filter:
                        synonym:
                            type: synonym
                            synonyms: ["katze, katz"]
                    analyzer:
                        synonyms:
                            tokenizer: standard
                            filter: [ lowercase, synonym ]

        types:
            article:
                mappings:
                    name: { analyzer: synonyms }
                    shortDescription: ~
                    description: ~
                    categories:
                        type: "nested"
                        properties:
                            name: ~
                persistence:
                    driver: orm
                    model: ShopBundle\Entity\Catalog\Article
                    provider: ~
                    finder: ~
                    listener: ~

When i search for "Katze" (German for cat), i get the expected results (Articles having the string "Katze" in its name. When i search for "Katz", i get 0 results.

This is a simpler configuration then i really use. I tried it with nGram tokenizer and other custom analyzers... I don't get rid of the feeling that elastic isn't indexing the field with analyzed content.

When i use the "_analyze" API endpoint, and i send a string and the analyzer name (one of my custom analyzers), the result (list of tokens) looks right!

Do i miss something?

Version of FOSElastica is 4.0.1 and elasticsearch server 5.6.3.

fredtro
  • 63
  • 7
  • We've now managed to set our analyzer as default analyzer (just by setting its name to "default"), which is then be used when searching. But we are still wondering why we are not able to set the analyzer at index time or at search time?! – fredtro Nov 03 '17 at 13:19

0 Answers0