Elasticsearch version: 5.2.2
Plugins installed: [none]
JVM version:
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
OS version:
CentOS 7
Description of the problem including expected versus actual behavior:
Fields should not be analyzed, not working with type : keyword, I still find the record when searching parts of a string
Steps to reproduce:
Create New Index, all future message fields in this index shall be not_analyzed (since v5 = type : keyword):
curl -X PUT 'http://10.2.5.230:9200/twitter' -d '{
"mappings": {
"tweet": {
"properties": {
"message": {
"type": "keyword"
}
}
}
}
}'
Get mapping for check:
curl -X GET 'http://10.2.5.230:9200/twitter/_mapping/tweet?pretty'
{
"twitter" : {
"mappings" : {
"tweet" : {
"properties" : {
"message" : {
"type" : "keyword"
}
}
}
}
}
}
Seems good, add record:
curl -X PUT 'http://10.2.5.230:9200/twitter/tweet/xyz?pretty' -d '{
"foo" : "2",
"message" : "trying out Elasticsearch"
}'
Now search for a part of the string "trying out Elasticsearch", should return in zero hits:
curl -X POST 'http://10.2.5.230:9200/twitter/tweet/_search?pretty' -d '{
"query": { "query_string": { "query" : "out" } }
}'
But it has been found:
{
"took" : 4,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.2876821,
"hits" : [
{
"_index" : "twitter",
"_type" : "tweet",
"_id" : "xyz",
"_score" : 0.2876821,
"_source" : {
"foo" : "2",
"message" : "trying out Elasticsearch"
}
}
]
}
}
Is it a bug or am I too stupid to use it?