# Can't use text fields in lens : Kibana

**URL:** <https://discuss.elastic.co/t/cant-use-text-fields-in-lens-kibana/272177>\
**Category:** Kibana\
**Tags:** lens\
**Created:** [May 5, 2021, 11:24am UTC](https://discuss.elastic.co/t/cant-use-text-fields-in-lens-kibana/272177 "2021-05-05T11:24:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sarra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sarra/32/88263_2.png) [@Sarra](https://discuss.elastic.co/u/Sarra)\
**Post date:** [May 5, 2021, 11:24am UTC](https://discuss.elastic.co/t/cant-use-text-fields-in-lens-kibana/272177/1 "2021-05-05T11:24:01Z")

</div>

Hello ,  
I am a beginner for Elastic search.I have some difficulties dealing with lens in Kibana.

I imported a csv dataset named : 'traces\_data' in Kibana .The main fields are : '_Code Op_', '_Pays_' ,' _Marque_' , '_Modèl_e' and _'Nom\_traces_' , which are **text** fields .However, 'Traduction Op' is a **keyword** field.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/8/0864237c986f45d6216794d75dd2c51a10f92419.png)

I have a problem in creating lens with the field 'TraductionOp' in kibana because it's a text field (non aggregatable) .That's why , i created a keyword field 'TraductionOp.raw ' by updating the mapping. At first the mapping was :

```auto
{
  "traces_data" : {
    "mappings" : {
      "_meta" : {
        "created_by" : "ml-file-data-visualizer"
      },
      "properties" : {
        "Code Op" : {
          "type" : "keyword"
        },
        "Marque" : {
          "type" : "keyword"
        },
        "Modéle" : {
          "type" : "keyword"
        },
        "Nom_traces" : {
          "type" : "keyword"
        },
        "Pays" : {
          "type" : "keyword"
        },
        "Traduction Op" : {
          "type" : "text"
        }
      }
    }
  }
}

```

I thought that creating a new **keyword** field for the **text** field '_Traduction Op_' would help, so I updated the mapping :

```auto
{
  "traces_data" : {
    "mappings" : {
      "_meta" : {
        "created_by" : "ml-file-data-visualizer"
      },
      "properties" : {
        "Code Op" : {
          "type" : "keyword"
        },
        "Marque" : {
          "type" : "keyword"
        },
        "Modéle" : {
          "type" : "keyword"
        },
        "Nom_traces" : {
          "type" : "keyword"
        },
        "Pays" : {
          "type" : "keyword"
        },
        "Traduction Op" : {
          "type" : "text",
          "fields" : {
            "raw" : {
              "type" : "keyword"
            }
          }
        }
      }
    }
  }
} 

```

However , this solution could'nt resolve the problem . When I tried to use the new keyword field : TraductionOp.raw in lens , I had no results found.

 ![lens](https://us1.discourse-cdn.com/elastic/original/3X/e/4/e41b0f540510d171e8ff257422497343c22b7cb1.png)  
I spent hours searching for an alternative to solve this problem . I would really appreciate your help .

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [May 5, 2021, 1:21pm UTC](https://discuss.elastic.co/t/cant-use-text-fields-in-lens-kibana/272177/2 "2021-05-05T13:21:51Z")

</div>

Did you re-index your data? Editing the mapping and adding the keyword field will not fill it with data from your documents - I think this is why Lens isn't able to "see" it.

Check out the reindex API: [Reindex API | Elasticsearch Guide [7.12] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html)

It will allow you to re-build the indices for you documents based on the mapping of the target index.

---

<div class="post-metadata">

**Author:** ![Sarra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sarra/32/88263_2.png) [@Sarra](https://discuss.elastic.co/u/Sarra)\
**Post date:** [May 5, 2021, 2:06pm UTC](https://discuss.elastic.co/t/cant-use-text-fields-in-lens-kibana/272177/3 "2021-05-05T14:06:55Z")

</div>

I re-indexed the data and it worked ! Thanks @flash1293

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 2, 2021, 2:07pm UTC](https://discuss.elastic.co/t/cant-use-text-fields-in-lens-kibana/272177/4 "2021-06-02T14:07:33Z")

</div>

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