elasticsearch,Node.js,elasticsearch" /> elasticsearch,Node.js,elasticsearch" />

使用node.js的弹性搜索映射

使用node.js的弹性搜索映射,node.js,elasticsearch,Node.js,elasticsearch,我使用下面的DSL查询创建了一个弹性搜索索引- 它已经是手动创建的,但我正在尝试使用node.js中的mongostatic对数据进行索引。我正在使用同步方法将我的mongodb集合索引到弹性搜索。我的nodejs映射代码应该是什么,这样它才能被正确地索引 { "settings": { "number_of_shards": 1, "analysis": {

我使用下面的DSL查询创建了一个弹性搜索索引- 它已经是手动创建的,但我正在尝试使用node.js中的mongostatic对数据进行索引。我正在使用同步方法将我的mongodb集合索引到弹性搜索。我的nodejs映射代码应该是什么,这样它才能被正确地索引

        { 
           "settings": { 
              "number_of_shards": 1, 
              "analysis": { 
                 "filter": { 
                    "ngram_filter": {    // ngrams analyzers
                       "type": "ngram", 
                       "min_gram": 2, 
                       "max_gram": 20 
                    } 
                 }, 
                 "analyzer": { 
                    "ngram_analyzer": { 
                       "type": "custom", 
                       "tokenizer": "standard", 
                       "filter": [ 
                          "lowercase", 
                          "ngram_filter" 
                       ] 
                    } 
                 } 
              } 
           }, 
           "mappings": { 
              "employees": { 
                 "_all": { 
                    "type": "string", 
                    "index_analyzer": "ngram_analyzer", 
                    "search_analyzer": "standard" 
                 }, 
                 "properties": {    // schema start
                    "FirstName": { 
                       "type": "string", 
                       "include_in_all": true, 
                       "term_vector": "yes", 
                       "index_analyzer": "ngram_analyzer", 
                       "search_analyzer": "standard" 
                    }  // it has more fiels as given in schema below
                 }      // schema end
              } 
           } 
        }

        my mongodb collection schema is - 
        {
        "FirstName": "MISTI",
        "LastName": "RAMSTAD",
        "Designation": "CEO",
        "Salary": "148000",
        "DateOfJoining": "23/09/1997",
        "Address": "32 Pawnee Ave. San Pablo, CA 94806",
        "Gender": "Female",
        "Age": 55,
        "MaritalStatus": "Unmarried",
        "I`enter code here`nterests": "Letterboxing,Scuba Diving,Mountain Biking,Handwriting Analysis,Models"
    }