I indexed the post and community models,
post = Index('posts')
post.settings(
number_of_shards=1,
number_of_replicas=0
)
@post.doc_type
class PostDocument(DocType):
community = fields.ObjectField(properties={
'id': fields.IntegerField(),
'description': fields.TextField(),
'name': fields.StringField(),
})
I want to search posts and aggregate the communities
(returns communities of the posts in the result)
I may need to use aggregation, I had difficulties while implementing it, the documentation was not clear for me.
q = Q("multi_match", query=query, fields=['title', 'content'])
document.query(q)
document.aggs.bucket('per_tag', 'terms', field='community')
community.id), not on an object field. Can you try that?not giving me the result I wantit's hard to know what you expect if you don't explain it ;-) Please show some sample data and what results you expect, it'll be much easier for everyoneCommunityobject not only the IDs