Search code examples
androidelasticsearchdjango-rest-frameworkdjango-haystack

How to make rest api for querying haystack elasticsearch?


I want to do search from android app using api build in django rest framework. Like haystack elasticsearch we can make search in html using django. Can any one tell how to use drf with elasticsearch ?


Solution

  • You should show us what you got so far

    I would:

    • pick one of the implementations of elasticsearch for django out there
    • create a DRF-serializer class for a single search result/or the specific model class (with the fields that you need on the frontend)
    • create a view that checks for a GET-parameter e.g. ?query=foo and use that to engage your search
    • then serialize the results and return it