elasticsearch-dsl使用
MetaField构建了父子关系:
class Location(DocType):
name = String(analyzer='snowball', fields={'raw': String(index='not_analyzed')})
latitude = String(analyzer='snowball')
longitude = String(analyzer='snowball')
created = Date()
class Meta:
doc_type = 'location'
class Building(DocType):
class Meta:
doc_type = 'building'
parent = MetaField(type='location')
如何插入和查询(HT到@Maresh): – DSL get:ChildDoc.get(id = child_id,routing = parent_id) – DSL插入:我相信它是child.save(id = child_id,routing = parent_id) – 字典插入:在字典中指定’_parent’:parent_id