Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with simple first app #80

Open
ameygat opened this issue Jan 29, 2018 · 7 comments
Open

Error with simple first app #80

ameygat opened this issue Jan 29, 2018 · 7 comments

Comments

@ameygat
Copy link

ameygat commented Jan 29, 2018

I am trying to run simple basic app to get eve_elastic running.
I have following settings.py and app.py files.
When I do a request:
curl localhost:5000/test

I get following error, here I am assuming eve_elastic would create test index in ES

# settings.py

RESOURCE_METHODS = ['GET','POST']
ITEM_METHODS = ['GET','PUT','PATCH','DELETE']
PUBLIC_RESOURCE_METHODS = ['GET','POST']
PUBLIC_ITEM_METHODS = ['GET','PUT','PATCH','DELETE']

DOMAIN = {
    'test': {
        'schema': {
            'foo': {
                'type': 'string'
            } 
        },
        'datasource': {
            'backend': 'elastic'
        }
    }
}
# app.py
from eve_elastic import Elastic
from eve import Eve

Eve(data=Elastic).run()

Call

a@a-virtual-machine ~/api/eve/app1 $ curl localhost:5000
{"_links": {"child": [{"href": "test", "title": "test"}]}}
a@a-virtual-machine ~/api/eve/app1 $ 

a@a-virtual-machine ~/api/eve/app1 $ curl localhost:5000/test
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request.  Either the server is overloaded or there is an error in the application.</p>

Error Serverside

(env) a@a-virtual-machine ~/api/eve/app1 $ python app.py 
WARNING:elasticsearch:GET /eve/test/_search [status:400 request:0.054s]
[2018-01-29 12:03:34,248] ERROR in app: Exception on /test [GET]
Traceback (most recent call last):
  File "/home/a/api/env/local/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/a/api/env/local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/a/api/env/local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/a/api/env/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/a/api/env/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/a/api/env/local/lib/python2.7/site-packages/eve/endpoints.py", line 54, in collections_endpoint
    response = get(resource, lookup)
  File "/home/a/api/env/local/lib/python2.7/site-packages/eve/methods/common.py", line 284, in rate_limited
    return f(*args, **kwargs)
  File "/home/a/api/env/local/lib/python2.7/site-packages/eve/auth.py", line 79, in decorated
    return f(*args, **kwargs)
  File "/home/a/api/env/local/lib/python2.7/site-packages/eve/methods/common.py", line 1040, in decorated
    r = f(resource, **combined_args)
  File "/home/a/api/env/local/lib/python2.7/site-packages/eve/methods/get.py", line 39, in get
    return get_internal(resource, **lookup)
  File "/home/a/api/env/local/lib/python2.7/site-packages/eve/methods/get.py", line 112, in get_internal
    return _perform_find(resource, lookup)
  File "/home/a/api/env/local/lib/python2.7/site-packages/eve/methods/get.py", line 184, in _perform_find
    cursor = app.data.find(resource, req, lookup)
  File "/home/a/api/env/local/lib/python2.7/site-packages/eve_elastic/elastic.py", line 481, in find
    hits = self.elastic(resource).search(body=query, **args)
  File "/home/a/api/env/local/lib/python2.7/site-packages/elasticsearch/client/utils.py", line 69, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/home/a/api/env/local/lib/python2.7/site-packages/elasticsearch/client/__init__.py", line 539, in search
    doc_type, '_search'), params=params, body=body)
  File "/home/a/api/env/local/lib/python2.7/site-packages/elasticsearch/transport.py", line 327, in perform_request
    status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
  File "/home/a/api/env/local/lib/python2.7/site-packages/elasticsearch/connection/http_urllib3.py", line 110, in perform_request
    self._raise_error(response.status, raw_data)
  File "/home/a/api/env/local/lib/python2.7/site-packages/elasticsearch/connection/base.py", line 114, in _raise_error
    raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
RequestError: TransportError(400, u'parsing_exception', u'no [query] registered for [filtered]')
@petrjasek
Copy link
Member

hey, I think you're running some unsupported elastic version, atm it works with 1.7-2.x

@ameygat
Copy link
Author

ameygat commented Jan 30, 2018

Oh, my ES is > 5 version :-(
any patchwork can give support to latest ES ? or this is too much to ask for ?

@petrjasek
Copy link
Member

it's a bit of work because there are no and/or queries in elastic >5, not sure when will get to it

@NoobSkywalker
Copy link

@petrjasek i recently tried to recreate the datalayer so it supports elasticsearch 6.0.0 and beyond. There have been some breaking changes. I have it on a fork here: https://github.com/NoobSkywalker/eve-elastic
if you verify/check we could come up with a support for es 6.0 and i could create a PR

@petrjasek
Copy link
Member

hey @NoobSkywalker - looks good, any idea if it would be possible to support both 2.x elastic and 5+ with same codebase? or are there any breaking changes in the api

@NoobSkywalker
Copy link

@petrjasek I am not sure if it is possible and does make sense to support both. The removal of mapping types is a very breaking change: https://www.elastic.co/guide/en/elasticsearch/reference/6.x/removal-of-types.html. And it completely changes how things should be done now in terms of mapping, parent-child relations etc.

@petrjasek
Copy link
Member

I see, yep that makes sense then, will probably create another branch for it then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants