Elasticsearch-dsl-py: How to return search results as JSON response of Restful service?

Created on 21 Oct 2014  路  1Comment  路  Source: elastic/elasticsearch-dsl-py

Is there any way to JSON serialize the search result (=Response object) and return as response of my Restful Django viewset endpoint? Since Response and Result objects' are invalidated JSON representation of objects (in __repr__ method) by adding some extra strings, it says Response object is not JSON serializable.

Most helpful comment

You can use the to_dict method on those objects to get the raw dictionary that is json serializable.

>All comments

You can use the to_dict method on those objects to get the raw dictionary that is json serializable.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vmogilev picture vmogilev  路  4Comments

takaomag picture takaomag  路  3Comments

beanaroo picture beanaroo  路  4Comments

vanzi picture vanzi  路  4Comments

rokcarl picture rokcarl  路  4Comments