2016-11-22 108 views

回答

0

您是否嘗試過使用not_analyzed字段?

嘗試這樣的映射:

{ 
    "template": "*", 
    "settings": { 
    "number_of_shards": 1, 
    "number_of_replicas": 0 
    }, 
    "mappings": { 
    "_default_": { 
     "dynamic_templates": [{ 
     "string_fields": { 
      "match": "*", 
      "match_mapping_type": "string", 
      "mapping": { 
      "type": "string", 
      "fields": { 
       "raw": { 
       "type": "string", 
       "index": "not_analyzed" 
       } 
      } 
      } 
     } 
     }] 
    } 
    } 
} 

然後你就可以查詢字段名稱[fieldname].raw。也許這有幫助。