开发者

Search Engine indexes and types

Being somewhat new to search engines, the notions of indexes and types are not v开发者_StackOverflowery clear to me. Elastic search has the notion of indexes and types where you can store a document.

Does the notion of an index correlate with a schema in a database? While the notion of a type correlate with a table?

Can someone please explain the purpose of having another grouping below indexes? Why can't we store all documents of the same type on a single index?


Does the notion of an index correlate with a schema in a database? While the notion of a type correlate with a table?

No and no. First, ElasticSearch is schema free: you don't have to specify upfront the structure of your documents. Just throw some JSON at ElasticSearch and it will happily index it, store it, retrieve it, search it.

The concept of index correlates to the notion of database: a database contains many tables, eg. heterogenously structured data.

The notion of type correlates to the notion of table: various types stored under one index can have different mapping, ie. different analyzers for fields, etc.

Another way how to look at types would be to look at them as column families in column databases such as HBase or Cassandra.

There is actually a very nice example in the ElasticSearch README: storing two different types of data (users and their tweets) in one index, named “twitter”.

(All that said, nobody forces you to exploit this feature: you can have one type under an index, if it makes sense for you.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜