What happens to the original text field?

When we use custom or built-in analyzer in our mapping it just convert the stream of characters to stream of tokens.
For example when we analyze the text like The QUICK brown foxes jumped over the dog!.Here i am using custom analyzer which using standard tokenizer and in token filter - lowercase, stemmer
Output in lucene index/Inverted index
[the,quick,brown,fox,jump,over,the,lazy,dog].

Original text is converted now.The old text is vanished now ? We can't search QUICK beacuse now it is quick , similarly foxes become fox we can't search foxes. Am i saying right?

Yes.

If you want to search for both things, you will need two analyzers.
You can use multi fields for this.

@dadoonet thank you for replying me😀

I have an index

PUT test_index
{
"settings": {
  "number_of_replicas": 0,
  "analysis": {
    "analyzer": {
      "custom_analyzer":{
        "type":"custom",
        "tokenizer":"standard",
        "filter":["lowercase","stemmer"]
      }
    }
  }
}, 
"mappings": { 
  "properties": {
    "text_field": {
      "type": "text",
      "analyzer": "custom_analyzer"
    }
  }
}
}

I am using only index time analysis.

I add the documents in it

POST test_index/_doc/1
{
  "text_field":"The QUICK brown foxes jumped over the dog!"
}

I am able to search QUICK it should not because we have quick. Does it mean custom analysis is also applied to query string ,I mean when I search for QUICK Elasticsearch analyzer convert this into quick. Because it happens only in search time analysis. And if we are not using search time analysis in our mapping does it means it applying to our mapping automatically.

text_field is only analyzed with the custom_analyzer analyzer.
Use multi fields instead.

In most cases, the same analyzer is applied at both index time and search time.

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