tsloughter / erlastic_search

An Erlang app for communicating with Elastic Search's rest interface.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Autocomplete works locally but not on my production application

stochastic-thread opened this issue · comments

Hello,

Locally I am able to type in queries in my local development environment while phoenix server is running, and everything works as expected. However in production, when I type any queries, I get this error message:

[info] Sent 500 in 30ms
[error] #PID<0.470.0> running Trophus.Endpoint terminated
Server: www.trophus.com:80 (http)
Request: GET /get_nearest?query=joe
** (exit) an exception was raised:
    ** (ArgumentError) argument error
        (erlastic_search) src/erls_resource.erl:67: :erls_resource.do_request/6
        (trophus) web/controllers/search_controller.ex:11: Trophus.SearchController.get_nearest/2
        (trophus) web/controllers/search_controller.ex:1: Trophus.SearchController.phoenix_controller_pipeline/2
        (trophus) lib/phoenix/router.ex:281: Trophus.Router.dispatch/2
        (trophus) web/router.ex:1: Trophus.Router.do_call/2
        (trophus) lib/trophus/endpoint.ex:1: Trophus.Endpoint.phoenix_endpoint_pipeline/1
        (trophus) lib/plug/debugger.ex:90: Trophus.Endpoint."call (overridable 3)"/2
        (trophus) lib/phoenix/endpoint/render_errors.ex:34: Trophus.Endpoint.call/2

Do you have any thoughts on what this could be due to? Thanks in advance!

The three critical lines for me are these:

    elastic_instance = ErlasticSearch.erls_params(host: "104.131.XYZ.ABC")      
    name_result = :erlastic_search.search(elastic_instance, "trophus", "name:#{query}*")  
    desc_result = :erlastic_search.search(elastic_instance, "trophus", "description:#{query}*")

These lines work when I use them in my production environment through iex -S mix but not in the application itself. Even more confused now that I can actually make it work in that environment.

How are you connecting? What do you mean by "autocomplete"?

Nvm I figured this issue out, no information yet but I will be sure to include it at some point (wrote myself a reminder to add soon). Please give me a day or so to append info without closing the issue. (<3)

@stochastic-threat - it's been 1163 days - might be time to close this issue.