Search by an incomplete id

Hi all,
I have a document with the id abc and the requirement that when user search by ab, it should return my document.
Currently, after I check Elasticsearch to see how appsearch indexes the document. I recoginize that the id field is diffrent from other fields, it's just stored as keyword.

"id": {
    "type": "keyword"

It means that when we want to search by id, we have to put an exact id (abc in my case), we could not search by ab or something similar.
So I'm thinking that I will store another field having the same value of the id field (because the id is generated by the app) to fulfill the requirement.
However, I wonder if we have another simpler solution for it?

Thanks in advance.

This is what I would suggest.

1 Like

Thanks, @JasonStoltz .