Why i can't search my text

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

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"
}

Is there any wrong configuration in index settings

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 to see how content is tokenized at index and search time.

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