Search API doesnt match "33" for "033" in document title


I couldn't figure it out how I can match the title e.g.: "Test title No.033" with query "33".
When I search for "033", it return the document. But for only "33" it doesnt return :frowning:

The guide is not very helpful for me (Search API | Elastic App Search Documentation [8.4] | Elastic)

Could you please help me with this?

What other information should I provide?

Hi Richard,

AppSearch uses Elasticsearch to store and search for documents. The way Elasticsearch works, it does not scan every field in every document for a substring, because that would be very slow. Instead, it analyzes text when it's indexed, and turns it into a list of tokens. In this case, the list will probably be ["test", "title", "033"] ("no" will be disregarded because it's a "stop word" in English language).

When you search for a string, Elasticsearch will look and see if any of the tokens in your search string match any of the tokens in the document's token list. In this case, "033" matches, but "33" will not.

I think your best bet to make that work may be to do some pre-processing on your titles before indexing them into App Search. If this is a common pattern you can have your indexing process split No.033 into No. 033 and then drop leading 0s so it's No. 33, or something to that effect.

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