Elasticsearch la création de l'index avec la cartographie

Je suis aux prises avec la tâche simple de la création de l'index, l'objectif est de créer un index avec un analyseur et un mappage de champ. Lorsque je créer un index avec un analyseur je peux parler à l'analyseur à travers l'analyse des appels d'api, mais quand j'ajoute les informations de mappage de la création de l'index des appels échoue avec "l'Analyseur de [analyzer1] non trouvé pour le champ [$champ]]", j'ai créé un script pour montrer le problème:

    #!/bin/bash

    INDEX_NAME="test1"

    echo "delete index just to be sure"
    curl -XDELETE "http://localhost:9200/$INDEX_NAME/"; echo

    echo "create new index"
    curl -X PUT "http://localhost:9200/$INDEX_NAME/" -d '{
        "index":{
            "analysis":{
                "analyzer":{
                    "analyzer1":{
                        "type":"custom",
                        "tokenizer":"standard",
                        "filter":[ "standard", "lowercase", "stop", "kstem", "ngram" ]
                    }
                },
                "filter":{
                    "ngram":{
                        "type":"ngram",
                        "min_gram":2,
                        "max_gram":15
                    }
                }
            }
        }
    }'; echo

    echo "analyze something with our shiny new analyzer"
    curl -XGET "localhost:9200/$INDEX_NAME/_analyze?analyzer=analyzer1&pretty=true" -d 'abcd'

    echo "remove the created index"
    curl -XDELETE "http://localhost:9200/$INDEX_NAME/"; echo

    echo "create new index again with mapping"
    curl -X PUT "http://localhost:9200/$INDEX_NAME/" -d '{
        "index":{
            "analysis":{
                "analyzer":{
                    "analyzer1":{
                        "type":"custom",
                        "tokenizer":"standard",
                        "filter":[ "standard", "lowercase", "stop", "kstem", "ngram" ]
                    }
                },
                "filter":{
                    "ngram":{
                        "type":"ngram",
                        "min_gram":2,
                        "max_gram":15
                    }
                }
            }
        },
        "mappings": {
            "product": {
                "properties": {
                    "title": {
                        "type": "string",
                        "search_analyzer" : "analyzer1",
                        "index_analyzer" : "analyzer1"
                    }
                }
            }
        }
    }'; echo

OriginalL'auteur user3327398 | 2014-02-19