2016-05-12 58 views

回答

0

我有同樣的問題。請執行以下操作以使其正常工作。

確保您刪除索引:

通過郵遞員例如DELETE請求:http://127.0.0.1:9200/ {your_name}

然後在節點JS創建這樣的映射:

var schema = new Schema({ 
    product_name: String, 
    description: { 
     type: String, 
     es_type: 'multi_field', 
     es_fields: { 
      multi_field: { type: 'string', index: 'analyzed' }, 
      untouched: { type: 'string', index: 'not_analyzed' } 
     } 
    } 
}); 

最後,你可以像這樣的查詢:

{ 
"query" : { 
    "constant_score" : { 
     "filter" : { 
      "term" : { 
       "description.multi_field" : "nog een testje" 
      } 
     } 
    } 
}}// to use other field, change the . after description 
{ 
"query" : { 
    "constant_score" : { 
     "filter" : { 
      "term" : { 
       "description.untouched" : "nog een testje" 
      } 
     } 
    } 
} 

}