# Why i can't search my text

**URL:** <https://discuss.elastic.co/t/why-i-cant-search-my-text/293618>\
**Category:** Elasticsearch\
**Created:** [January 6, 2022, 5:55am UTC](https://discuss.elastic.co/t/why-i-cant-search-my-text/293618 "2022-01-06T05:55:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aniket\_Pant](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Aniket\_Pant](https://discuss.elastic.co/u/Aniket_Pant)\
**Post date:** [January 6, 2022, 5:55am UTC](https://discuss.elastic.co/t/why-i-cant-search-my-text/293618/1 "2022-01-06T05:55:28Z")

</div>

```auto
PUT my-index-000001
{
    "settings":{
     "number_of_replicas": 0, 
      "analysis":{
         "analyzer":{
            "my_analyzer":{ 
               "type":"custom",
               "tokenizer":"keyword",
               "filter":["lowercase"]
               },
               "search_time":
               { "type": "custom",
                 "tokenizer":"standard",
                 "filter":["lowercase"]
               }
         }
      }
   },
   "mappings":{
       "properties":{
          "title": {
             "type":"text",
             "analyzer":"my_analyzer",
             "search_analyzer": "search_time"
          }
      }
   }
}

```

Index some random data for testing

```auto
PUT my-index-000001/_doc/1
{
   "title":"Abhishek Kumar/31F7CB4AB7B391933E7D4EE8D2478EA4"
}

PUT my-index-000001/_doc/2
{
   "title":"Abhishek Sharma/7FE41C9537A8C409C91ABA411B9C59EF"
}

PUT my-index-000001/_doc/3
{
   "title":"Abhishek Kumar/73DBA25696A5CD0AE050B2099497692D"
}

```

 ![pic1](https://us1.discourse-cdn.com/elastic/original/3X/c/a/ca3e595e287e9171c0582a0dcad997cfa8a16c63.png)

 ![pic2](https://us1.discourse-cdn.com/elastic/original/3X/2/4/247b4a734c0148cd5d29c5605539d99404ced706.png)

Is there any wrong configuration in index settings

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 6, 2022, 6:01am UTC](https://discuss.elastic.co/t/why-i-cant-search-my-text/293618/2 "2022-01-06T06:01:18Z")

</div>

What is it you are trying to achieve through your custom analyzer? Why have a different index time and search time analyzer?

As you are indexing using a keyword analyser at index time Elasticsearch will store the full field content as a single term. Your search time analyzer however uses the standard tokenizer, which splits terms on whitespace and therefore will break the field into multiple tokens. These will not match which is why your search is not returning anything.

I would recommend using the [analyze API](https://www.elastic.co/guide/en/elasticsearch/reference/7.16/test-analyzer.html) to see how content is tokenized at index and search time.

---

<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:** [February 3, 2022, 6:20am UTC](https://discuss.elastic.co/t/why-i-cant-search-my-text/293618/4 "2022-02-03T06:20:26Z")

</div>

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