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()
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>
(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]')