Term request with normalized keyword behave strangely

After I had a look at this post, I thought i was dumb

But with the following test, play it in the given order, I think the term query does some normalization even if it should not on a 5.2.2 Elastcisearch installation

Am I wrong ?

Thanks

PUT data
{
"mappings": {
"product": {
"properties": {
"code": {
"type": "keyword"
}
}
}
},
"settings": {
"index": {
"analysis": {
"normalizer": {
"lower": {
"filter": [
"lowercase"
],
"type": "custom"
}
}
}
}
}
}

PUT data/product/1
{
"code": "AbC"
}

POST data/product/_search
{
"query": {
"term": {
"code": {
"value": "abc" //No result as expected
}
}
}
}

POST data/product/_search
{
"query": {
"term": {
"code": {
"value": "Abc" //No result as expected
}
}
}
}

POST data/product/_search
{
"query": {
"term": {
"code": {
"value": "AbC" //One result as expected
}
}
}
}

DELETE data
PUT data
{
"mappings": {
"product": {
"properties": {
"code": {
"type": "keyword",
"normalizer": "lower"
}
}
}
},
"settings": {
"index": {
"analysis": {
"normalizer": {
"lower": {
"filter": [
"lowercase"
],
"type": "custom"
}
}
}
}
}
}

PUT data/product/1
{
"code": "AbC"
}

POST data/product/_search
{
"query": {
"term": {
"code": {
"value": "abc" //One result is not expected here with term query
}
}
}
}

POST data/product/_search
{
"query": {
"term": {
"code": {
"value": "Abc" //One result is not expected here with term query
}
}
}
}

POST data/product/_search
{
"query": {
"term": {
"code": {
"value": "AbC"
}
}
}
}

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