I have an app with approximately 20-40 million new documents added each month. Let's say these documents have approximately 4-8 fields I want to allow the user to search from. Not all entries are valid for a search and they will eventually expire from the table/collection, but I would like to create a quick search, where a customer can input something like a number or text, and an autocomplete input will return 5-10 top results. Depending on the type of search word (number/string), I can limit the query to specific fields, as some are numeric, rest are text based.

An example document in JSON format:

    "name": "Tesla Model S",
    "code": "tesla-model-s",
    "serial_number": "31289A90321SD",
    "shelf_number": 9387573,
    "inventory_id": 9093293828

Users need to be able to search from millions of documents (we can limit this to some degree), by writing a keyword such as Tes or model-s or 9387 and the data storage should return closest results. If the entry is numeric (9387) I can target the query to shelf_number and inventory_id but if it's a string, I can query fields such as name, code and serial_number.

Current options:

  • Relational databases support searching using LIKE, but not sure if the performance is optimal.
  • MongoDB requires numeric entries to be text for this. Can't search numbers like this.

What would you recommend?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.