Home > Net >  How can I design a NoSQL database for all English words?
How can I design a NoSQL database for all English words?

Time:03-14

I would like to know what the most efficient way is to design a NoSQL database for all English words. I was thinking of creating different documents e.g. wordlength-1, wordlength-2, wordlength-3, wordlength-4 etc which will store all words of length 1,2,3 respectively. Each such document will store multiple objects e.g A, B, C ... ,Z where A will will store all words starts with 'A', B will store all words starts with 'B' so on and so forth.

wordlength-3 : {
     A : { act, art, ass, ... },
     B : {bat, bot, bug ...},
}
  1. how can we efficiently search word using pattern like ape*t or based on word length and first letter of the word?
  2. Are there any other ways to design such database so that any search will be done very efficiently ?

CodePudding user response:

For searching you can use Elastic search. It also stores Document in unstructured way as save in NoSQL.It will help to resolve your both issue.

Elasticsearch uses a data structure called an inverted index that supports very fast full-text searches. An inverted index lists every unique word that appears in any document and identifies all of the documents each word occurs in.

[1]https://www.elastic.co/what-is/elasticsearch

It will help in searching the data quickly and in near real-time and give back answers in milliseconds

  • Related