PUT test/_doc/1 { "content":"Hello World" } GET test/_mapping { "test" : { "mappings" : { "properties" : { "content" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } } } } } } GET test/_analyze { "explain": true, "analyzer": "standard", "text": "Hello World" } POST test/_search { "profile": "true", "query": { "match": { "content": "Hello World" } } } POST test/_search { "profile": "true", "query": { "match": { "content": "hello world" } } } #查的到数据,因为content.keyword在存数据的时候不分词,不做任何处理.存的就是Hello World POST test/_search { "profile": "true", "query": { "match": { "content.keyword": "Hello World" } } } #查不到数据,因为content.keyword在存数据的时候不分词,不做任何处理.存的就是Hello World,而你用小写的hello world去查询,所以查不到数据 POST test/_search { "profile": "true", "query": { "match": { "content.keyword": "hello world" } } } #查不到,termquery :content:Hello World,你存的数据content是hello POST test/_search { "profile": "true", "query": { "term": { "content": "Hello World" } } } #termquery.查不到content作为整体去查 POST test/_search { "profile": "true", "query": { "term": { "content": "hello world" } } } #查的到,content存的数据是Hello World,所以查得到 POST test/_search { "profile": "true", "query": { "term": { "content.keyword": "Hello World" } } }