# mapping的index PUT s9 { "mappings": { "properties": { "t1":{ "type": "text", "index": true }, "t2": { "type": "text", "index": false # index为false时es不会为该属性创建索引(本质是不做分词),也就是说不能当做主查询条件 (默认为true) } } } } PUT s9/_doc/1 { "t1": "论母猪的产前保养", "t2": "论母猪的产后恢复" } GET s9/_search { "query": { "match": { "t1": "论" } } }
# 报错,是因为该字段index参数为false导致的 GET s9/_search { "query": { "match": { "t2": "论" } } }