Very nice Jim Simon!

In addition to allowing searchable_fields to be explicitly defined on the Django model you might also include indexing all fields on a model by default. You can get the fields of a model and their internal type with:

You’d need a function that translates the fields internal type to ES types. This could be done with an if statement in a separate function. That way you’d achieve a smarter solution that automatically maps each field with correct type.

--

--

Javascript developer. Passionate learner.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store