You need to first create your index using the index parameters (analyzer):
"analysis" : { "analyzer" : { "str_search_analyzer" : { "tokenizer" : "keyword", "filter" : ["lowercase"] }, "str_index_analyzer" : { "tokenizer" : "keyword", "filter" : ["lowercase", "ngram"] } }, "filter" : { "ngram" : { "type" : "ngram", "min_gram" : 2, "max_gram" : 20 } } }
Then you can define a mapping for your type:
"autocomplete_questions": { "_boost" : { "name" : "po", "null_value" : 1.0 }, "properties": { "po": { "type": "double" }, "text": { "type": "string", "boost": 3.0, "search_analyzer" : "str_search_analyzer", "index_analyzer" : "str_index_analyzer" } } }
And only then can you create a river:
curl -XPUT "localhost:9200/_river/autocompleteindex/_meta" -d ' { "type": "mongodb", "mongodb": { "host": "rahulg-dc", "port": "27017", "db": "qna", "collection": "autocomplete_questions" }, "index": { "name": "autocompleteindex", "type": "autocomplete_questions"} }
Does it help?
dadoonet
source share