Problem when creating an index not analyzed, to perform term searches in texts


(Elvis Goncalves) #1

Try to create an index with a field that is not analyzed in order to perform a string search. But when I try to create the index it generates errors.

In this way I create the index:

PUT / contents
{

"mappings": {

"category": {

"_all": {"enabled": false},

"_source": {"compressed": true},

"properties": {

"name": {"type": "text", "index": "analyzed"}

}

}

}

}

and it generates me error:

{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [category]: Could not convert [name.index] to boolean"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [category]: Could not convert [name.index] to boolean",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Could not convert [name.index] to boolean",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Failed to parse value [analyzed] as only [true] or [false] are allowed."
}
}
},
"status": 400
}

How it should create that certain fields are not analyzed so you can search the text strings.


(Guido Lena Cota) #2

Hi, since Elasticsearch version 5.x, you can use the keyword datatype for not analysed strings (https://www.elastic.co/guide/en/elasticsearch/reference/current/keyword.html).


(system) closed #3

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