radar / elastic

A thin veneer over HTTPotion that talks to Elastic Search
https://hex.pm/packages/elastic
MIT License
65 stars 22 forks source link

Reject empty strings in Index.name/1 #19

Closed amrfaissal closed 5 years ago

amrfaissal commented 5 years ago

After accidentally setting index_prefix to "", Index.name/1 returns "_my-index" when making search requests or scrolling (I've spent an hour trying to figure out why Elasticsearch is returning empty hits). To prevent this from happening again, I think rejecting empty strings would be handy.

Thanks for the awesome work!

radar commented 5 years ago

Looks great to me :) Thank you! Could you please add a test for this at test/elastic/index_test.exs too?

amrfaissal commented 5 years ago

I've added a helper module ElasticTestUtil in test_helper.exs (would come in handy in the future) to allow temporary change of Application env values, also a test case for this change.

radar commented 5 years ago

I have just published 3.1.1 with this change. Thanks!