Выбор связей между объектами

24 views
Skip to first unread message

hellboy

unread,
Apr 16, 2015, 3:52:25 AM4/16/15
to elastics...@googlegroups.com
In ElasticSearch, there are different ways in which you can manage relationships between
objects:

  1. Embedding with type=object: This is implicitly managed by ElasticSearch, and it considers the embedded as part of the main document. It's fast but you need to reindex the main document to change a value of the embedded object.
  2. Nesting with type=nested: This allows a more accurate search and filtering of the parent, using a nested query on the children. Everything works as in the case of an embedded object, except for the query.
  3. External child documents: This is a document in which the children are external documents, with a _parent property to bind them to the parent. They must be indexed in the same shard as the parent.
    The join with the parent is a bit slower than with the nested one, because the nested objects are in the same data block as the parent in the Lucene index and they are loaded with the parent; otherwise
    the child documents require more read operations.
Choosing how to model the relationship between objects depends on your application scenario.

Кака должна быть стратегия выбора, при следующей структуре документа:

Служебные поля
filter: {
   Поля, по которым должен осуществляться фильтрация (точная, с возможным AND, полнотекстовый поиск не нужен)
}
data: {
  Поля, которые не должны индексироваться
}


Какой путь нужно выбирать 1)  или 2) ? И почему?

Igor Motov

unread,
Apr 16, 2015, 8:52:48 AM4/16/15
to elastics...@googlegroups.com
Вы не могли бы привести пример документа и запроса?
Reply all
Reply to author
Forward
0 new messages