Not_analyzed is not working

Hi everyone,
I am new to Elasticsearch, and using ES 5.1.1. When I create a Map for my type, I set property "index" of a text field to "not_analyzed", but when I try to query document using term filter, it did not return any matched documents, or when I test the mapping, the text is split. Could anyone please help me out of this? Thanks in advance.

I create a mapping:
PUT /gb
{
"mappings": {
"tweet": {
"properties": {
"tag": {
"type": "text",
"index": "not_analyzed"
}
}
}
}
}

I add a document
PUT gb/tweet/1
{
"tag": "Black-cats"
}


I query document using term filter: return no documents
GET gb/tweet/_search
{
"query": {
"term": {
"tag": "Black-cats"
}
}
}


I test the mapping: didn't return 1 term, but 2 (black, and cat)
GET gb/_analyze
{
"field": "tag",
"text": ["Black-cats"]
}

Try with type: keyword instead.

Index: not_analyzed is deprecated but it should do the same thing. Might be a bug. https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-index.html

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.