Product-code search in an online store should first verify the code in the catalog. When there is one confirmed match, the AI assistant shows the product page for that exact item (SKU). When there are multiple matches, it asks for the manufacturer or variant. Similar products can be offered separately if the shopper agrees to recommendations.
This FAQ from Vladimir Lomtev’s AI studio is for e-commerce teams that are adding semantic search or chat to an existing catalog. The examples use fictional items. The Elasticsearch and Unicode recommendations were checked against the original sources on November 20, 2026.
- When should the assistant search for an exact SKU?
- How should an SKU be stored for exact search in Elasticsearch?
- Can spaces, hyphens, and case differences be removed?
- What should you answer if a code has multiple matches?
- When can you suggest a similar product?
- How can you verify that vector search is not replacing the result?
When should the assistant search for an exact SKU?
Run an exact search if the shopper entered the code in the “SKU” field, pasted it into the search box, or explicitly mentioned it in the message. For example, from the phrase “Do you have filter AF-007?” the assistant can extract the original string AF-007 and pass it to the catalog. Here, the model parses the phrase, and the catalog confirms which product matches the code.
A short string 007 can be an SKU, part of a number, or a specification. If the meaning is unclear from the request and context, ask: “Is 007 an SKU?” For the phrase “Filter for a compressor, diameter 80 mm,” semantic and title-based search works, with the diameter verified on the product page. For the request “Need an alternative to AF-007,” first find the original SKU, then suggest alternatives based on confirmed specifications and compatibility.
One format rule like “letters, a hyphen, and numbers” rarely describes the entire catalog. Take real codes from different brands in the export and check whether there are purely numeric, short, and composite ones among them. For mixed requests, keep both the original text and the extracted code so the shopper can notice a recognition error.
How should an SKU be stored for exact search in Elasticsearch?
Store the SKU as a string in a keyword field, and use a term query for exact-value search. A text field is analyzed for full-text search, so you should not rely on it preserving the code as a single term. Keep your own search fields for the product name and description. keyword type · term query.
Example search request body for the sku field of type keyword without a normalizer. The request refers to a fictional catalog and is shown from the documentation. It was not run in Elasticsearch.
{
"query": {
"term": {
"sku": {
"value": "AF-007"
}
}
}
}
In a production catalog, apply search-scope filters such as store or manufacturer if the shopper has already specified one. To determine the outcome, you need enough data to distinguish zero, one, and several different product identifiers. If you query only the first row, you will not know that the same code belongs to another manufacturer. If the index stores records from multiple warehouses, first consolidate results with the same SKU ID, then check stock by warehouse.
If subfields were added to an existing Elasticsearch field with fields, older documents will not automatically get the new values. Populate the subfield for older documents and separately verify the code that was added to the catalog before the schema change. Elastic documentation on multi-fields.
Can spaces, hyphens, and case differences be removed?
Change the code format only based on confirmed catalog rules. Keep the original value on the product page. For example, a catalog where case is always irrelevant can use a separate search field for case-insensitive matching. Elasticsearch supports lowercase for keyword and applies the normalizer at indexing and search time for that field. Before enabling the rule, compare which different SKUs become the same key after conversion. Elastic documentation on normalizer.
A leading zero and a hyphen can be part of the identifier. If AF007 appears as an older form of AF-007, create a confirmed mapping for that item. If AF007 is already assigned to another product in the same scope, escalate the conflict to the catalog owner before enabling the mapping. A separate guide will be useful for working with source files. How to preserve SKUs and leading zeros in CSV.
Latin A (U+0041) and Cyrillic A (U+0410) look alike, but they have different code points. This kind of substitution can be used as a reason to prompt for input verification. Automatic replacement can merge two valid items. Unicode describes mechanisms for detecting visually confusable strings, and your catalog determines whether a particular spelling is allowed. Unicode UTS #39, Confusable Detection.
What should you answer if a code has multiple matches?
Ask the shopper for the attribute that distinguishes the matched items. If two manufacturers have AF-007, show both brands and ask: “Which manufacturer is listed on the package?” If the brand is the same, the variants may differ in package contents or compatibility. Use the distinguishing attribute from the product pages.
One match after filtering by availability does not resolve the original ambiguity. If only the Nord item is left in stock, the shopper may still have meant the Volna item. First match the code within the allowed catalog scope, then check availability for the needed SKU. This order is especially important if the assistant can add the item to the cart.
When can you suggest a similar product?
Offer recommendations only after an explicit request for an alternative or after the shopper agrees. If the full code is missing, say there are no matches for that code. If the code is found but the product is out of stock, say the found SKU is out of stock. If there is a timeout or an incomplete search response, say the catalog could not be checked right now. You cannot claim from an incomplete response that the code is unique or absent. In all three situations, the shopper needs different next steps.
| Search query or catalog state | Assistant response |
|---|---|
| “AF-008 filter,” one SKU found | Show the product page and check availability for this item |
| “AF-007,” Nord and Volna found | Ask for the manufacturer before selecting a product page |
| “AF007 Nord,” a confirmed mapping is known for Nord | Show the canonical code AF-007 and the Nord card |
| "AF-099," the catalog response is successful, no matches found | Report that there is no match and suggest checking the item labeling |
AF-008 found, inventory is zero |
Show the found item with the status "out of stock" |
| The code search timed out | Report the failure and suggest retrying the request |
| "Find a replacement for AF-008" | Find the original item and compare candidates by verified parameters |
When suggesting alternatives, show the candidates’ SKUs and the characteristics that determine compatibility. If the product cards do not include data on the fit dimension or equipment model, ask the customer for it. The fewer required parameters that are confirmed, the narrower the promise the assistant can make.
How do you check that vector search is not replacing the result?
Check which identifier the interface receives and whether description-based matching is being called. The minimum test set for the catalog includes an exact code, a valid similar code, an ambiguous code, an unknown code, and a catalog error. Define the expected response for each. For example, when entering AF-099 the AF-008 card should not appear as a match by SKU, even if it is the closest by semantic similarity. For a description-based query, you can run a normal search. How hybrid search works for RAG.
This Python example chooses an action after the catalog response. The function takes a list of already found SKU identifiers. The value None means a search error, and an empty list means a successful response with no matches. The exact_code mode is determined by the application before contacting the catalog. The description-based matching branch is suitable for a query without a code. An explicit request for a replacement by code requires resolving the original SKU first.
def reply_route(exact_code, catalog_ids):
if not exact_code:
return "search_description", None
if catalog_ids is None:
return "catalog_error", None
unique_ids = set(catalog_ids)
if not unique_ids:
return "unknown_code", None
if len(unique_ids) > 1:
return "clarify", None
return "show_product", unique_ids.pop()
The function was tested locally on six fictional inputs. One SKU, including a repeated same item, returned show_product. Two different SKUs returned clarify, an empty list returned unknown_code, an error returned catalog_error, and a description-based query returned search_description. The test covered only this function. Model code extraction, the Elasticsearch query, and the interface behavior still need to be tested in your integration.
How to connect SKU search with a store catalog
Vladimir Lomtev’s AI studio can analyze where the assistant gets the SKU, connect catalog search with the chat response, and check which product the customer sees in the event of an ambiguous query. To get started, one catalog, an example query with an incorrect substitution, and the original product card are enough. Discuss the task.
What result should be considered correct
The assistant returns the confirmed SKU, asks the user to distinguish between candidates, or explains why the check did not produce a product card. It checks availability for the already selected item. Semantic matching remains available as a separate action, and the options from it are passed along with their own SKUs and verified parameters.


