-
Notifications
You must be signed in to change notification settings - Fork 801
Description
I'm having issues using "simple_query_string".
The following works:
q = Q("match", body = {"query": search_term, "operator": "and", "fuzziness": 'auto'})
s = Search(using=client, index="testindex")
s = s.query(q)
response = s.execute()
But not this:
q = Q("simple_query_string", body = {"query": search_term, "fields": ["body"]})
s = Search(using=client, index="testindex")
s = s.query(q)
response = s.execute()
I get the following error:
RequestError: RequestError(400, 'parsing_exception', '[simple_query_string] unknown token [START_OBJECT] after [body]')
Traceback:
File "c:\users\timothy\miniconda3\envs\drugfda\lib\site-packages\streamlit\ScriptRunner.py", line 314, in _run_script
exec(code, module.dict)
File "D:\Documents\Python Projects\Drugs@FDA\fdadocsearch.py", line 59, in
response = s.execute()
File "c:\users\timothy\miniconda3\envs\drugfda\lib\site-packages\elasticsearch_dsl\search.py", line 698, in execute
**self._params
File "c:\users\timothy\miniconda3\envs\drugfda\lib\site-packages\elasticsearch\client\utils.py", line 84, in wrapped
return func(*args, params=params, **kwargs)
File "c:\users\timothy\miniconda3\envs\drugfda\lib\site-packages\elasticsearch\client_init.py", line 1548, in search
"GET", _make_path(index, doc_type, "_search"), params=params, body=body
File "c:\users\timothy\miniconda3\envs\drugfda\lib\site-packages\elasticsearch\transport.py", line 358, in perform_request
timeout=timeout,
File "c:\users\timothy\miniconda3\envs\drugfda\lib\site-packages\elasticsearch\connection\http_urllib3.py", line 261, in perform_request
self._raise_error(response.status, raw_data)
File "c:\users\timothy\miniconda3\envs\drugfda\lib\site-packages\elasticsearch\connection\base.py", line 182, in _raise_error
status_code, error_message, additional_info