Elasticsearch create index api created a all uppercase field index


(xmb) #1

I'm working with elasticsearch 6.2.4 and using the following code to create an index.

CreateIndexRequest request = new CreateIndexRequest(indexName);
request.source(jsonSource, XContentType.JSON);
CreateIndexResponse cir = esClient.indices().create(request);

The json is something like this

>     {
>         "mappings": {
>             "info": {
>                 "properties": {
>                     "id": {
>                         "analyzer": "ik_smart",
>                         "type": "text"
>                     },
>                     "sex": {
>                         "analyzer": "ik_smart",
>                         "type": "text"
>                     },
>                     "name": {
>                         "analyzer": "ik_smart",
>                         "type": "text"
>                     }
>                 }
>             }
>         }
>     }

It creates the index and gives me all uppercase field .

"mappings": {
      "info": {
        "properties": {
           "ID": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "SEX": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "NAME": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "id": {
            "type": "text",
            "analyzer": "ik_smart"
          },
          "sex": {
            "type": "text",
            "analyzer": "ik_smart"
          },
          "name": {
            "type": "text",
            "analyzer": "ik_smart"
          }
}

Why would this happen and Can you guys offer me a solution?


(David Pilato) #2

Look at the content you sent when you indexed documents. You are probably using uppercase.


(xmb) #3

Thanks,my mistake to get this happen.


(system) #4

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