maggienj / ActiveData

Provide high speed filtering and aggregation over data
Mozilla Public License 2.0
0 stars 0 forks source link

ES5 - [bool] query does not support [query] #15

Closed maggienj closed 7 years ago

maggienj commented 7 years ago

Unit Test: tests.test_load_and_save_queries.TestLoadAndSaveQueries.test_save_then_load

caused by
    ERROR: Bad Request: {"error":{"root_cause":[{"type":"parsing_exception",
"reason":"[bool] query does not support [query]","line":1,"col":72}],"type":"parsing_exception",
"reason":"[bool] query does not support [query]","line":1,"col":72},"status":400}
    File "C:\Users\user\PycharmProjects\ActiveData\pyLibrary\env\elasticsearch.py", line 760, in post
    File "C:\Users\user\PycharmProjects\ActiveData\pyLibrary\env\elasticsearch.py", line 428, in search
    File "C:\Users\user\PycharmProjects\ActiveData\pyLibrary\queries\jx_usingES.py", line 214, in update
    File "C:\Users\user\PycharmProjects\ActiveData\active_data\actions\save_query.py", line 109, in find
    File "C:\Users\user\PycharmProjects\ActiveData\active_data\actions\save_query.py", line 44, in find_query
    File "C:\Users\user\PycharmProjects\ActiveData\active_data\__init__.py", line 54, in output
    File "C:\Python27\lib\site-packages\flask\app.py", line 1598, in dispatch_request
    File "C:\Python27\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
    File "C:\Python27\lib\site-packages\flask\app.py", line 1982, in wsgi_app
    File "C:\Python27\lib\site-packages\flask\app.py", line 1994, in __call__
    File "C:\Python27\lib\site-packages\werkzeug\serving.py", line 197, in execute
    File "C:\Python27\lib\site-packages\werkzeug\serving.py", line 209, in run_wsgi
    File "C:\Python27\lib\site-packages\werkzeug\serving.py", line 267, in handle_one_request
    File "C:\Python27\lib\BaseHTTPServer.py", line 340, in handle
    File "C:\Python27\lib\site-packages\werkzeug\serving.py", line 232, in handle
    File "C:\Python27\lib\SocketServer.py", line 652, in __init__
    File "C:\Python27\lib\SocketServer.py", line 331, in finish_request
    File "C:\Python27\lib\SocketServer.py", line 596, in process_request_thread
    File "C:\Python27\lib\threading.py", line 754, in run
    File "C:\Python27\lib\threading.py", line 801, in __bootstrap_inner
    File "C:\Python27\lib\threading.py", line 774, in __bootstrap

kabalidaa (pid 22356) - 2017-06-07 01:10:55 - Main Thread - "elasticsearch.py:1096" (search) - 
Query /testing_000_p/test_result/_search
    {
        "from": 0,
        "query": {"bool": {"filter": {"match_all": {}}}},
        "size": 10,
        "stored_fields": ["a"]
    }
    ERROR: Problem with search (path=/saved_queries20170524_113002/query/_search):
    {
        "query": {"bool": {
            "filter": {"term": {"hash": "vHVozfzn"}},
            "query": {"match_all": {}}
        }},
        "size": 200000,
        "stored_fields": []
    }
maggienj commented 7 years ago

From ES docs... "The boolean query doesn't have a query clause. " So, will have to try removing query clause...

https://github.com/elastic/elasticsearch-php/issues/501

maggienj commented 7 years ago

Should match_all be part of a "must" clause instead of a query clause... as shown here... https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html

will try this.. in elasticsearch-head

maggienj commented 7 years ago

So, should the query be changed like this?

{
  "query": {
    "bool": {
      "must": {
        "match_all": {}
      },
      "filter": {
        "term": {
          "hash": "vHVozfzn"
        }
      },
      "stored_fields": []
    }
  }
}
klahnakoski commented 7 years ago

I imagine the "must":{"match_all":{}} can be removed, since it says nothing. I am concerned that size is not supported; be sure it is a property of the correct object (not of query).

maggienj commented 7 years ago

Ref: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html

maggienj commented 7 years ago

now it is showing a diff err related to size. so, will reduce the size value and check if that works...


caused by
    ERROR: Internal Server Error: {"error":{"root_cause":[{"type":"query_phase_execution_exception","reason":"Result window is too large, 
from + size must be less than or equal to: [10000] but was [200000]. 
See the scroll api for a more efficient way to request large data sets. 
This limit can be set by changing the [index.max_result_window] index level setting."}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"saved_queries20170524_113002","node":"OX5gNnXQRtW6gThYBtxJ4w","reason":{"type":"query_phase_execution_exception","reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [200000]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting."}}],"caused_by":{"type":"query_phase_execution_exception","reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [200000]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting."}},"status":500}
    File "C:\Users\user\PycharmProjects\ActiveData\pyLibrary\env\elasticsearch.py", line 760, in post
    File "C:\Users\user\PycharmProjects\ActiveData\pyLibrary\env\elasticsearch.py", line 428, in search
    File "C:\Users\user\PycharmProjects\ActiveData\pyLibrary\queries\jx_usingES.py", line 213, in update
    File "C:\Users\user\PycharmProjects\ActiveData\active_data\actions\save_query.py", line 109, in find
    File "C:\Users\user\PycharmProjects\ActiveData\active_data\actions\save_query.py", line 44, in find_query
    File "C:\Users\user\PycharmProjects\ActiveData\active_data\__init__.py", line 54, in output
    File "C:\Python27\lib\site-packages\flask\app.py", line 1598, in dispatch_request
    File "C:\Python27\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
    File "C:\Python27\lib\site-packages\flask\app.py", line 1982, in wsgi_app
    File "C:\Python27\lib\site-packages\flask\app.py", line 1994, in __call__
    File "C:\Python27\lib\site-packages\werkzeug\serving.py", line 197, in execute
    File "C:\Python27\lib\site-packages\werkzeug\serving.py", line 209, in run_wsgi
    File "C:\Python27\lib\site-packages\werkzeug\serving.py", line 267, in handle_one_request
    File "C:\Python27\lib\BaseHTTPServer.py", line 340, in handle
    File "C:\Python27\lib\site-packages\werkzeug\serving.py", line 232, in handle
    File "C:\Python27\lib\SocketServer.py", line 652, in __init__
    File "C:\Python27\lib\SocketServer.py", line 331, in finish_request
    File "C:\Python27\lib\SocketServer.py", line 596, in process_request_thread
    File "C:\Python27\lib\threading.py", line 754, in run
    File "C:\Python27\lib\threading.py", line 801, in __bootstrap_inner
    File "C:\Python27\lib\threading.py", line 774, in __bootstrap
klahnakoski commented 7 years ago

please push your changes so I may see the net effect.

maggienj commented 7 years ago

changes pushed.

klahnakoski commented 7 years ago

I believe this is fixed: You may close this.