SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.
Python bingbravedegoogleduckduckgogooglemetasearchprivacypythonqwantsearchsearch-enginesearxsearxngstartpageyahoo
[engine] elasticsearch: add pagination support
Bnyrobbb2894b0492
diff --git a/searx/engines/elasticsearch.py b/searx/engines/elasticsearch.pyindex 6331a992e..c4992b02f 100644--- a/searx/engines/elasticsearch.py+++ b/searx/engines/elasticsearch.py@@ -29,7 +29,7 @@ authentication configured to read from ``my-index`` index... code:: yaml- name: elasticsearch- shortcut: es+ shortcut: elsengine: elasticsearchbase_url: http://localhost:9200username: elastic@@ -46,16 +46,26 @@ from searx.exceptions import SearxEngineAPIExceptionfrom searx.result_types import EngineResultsfrom searx.extended_types import SXNG_Response+categories = ['general']+paging = True++about = {+ 'website': 'https://www.elastic.co',+ 'wikidata_id': 'Q3050461',+ 'official_api_documentation': 'https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html',+ 'use_official_api': True,+ 'require_api_key': False,+ 'format': 'JSON',+}base_url = 'http://localhost:9200'username = ''password = ''index = ''-search_url = '{base_url}/{index}/_search'query_type = 'match'custom_query_json = {}show_metadata = False-categories = ['general']+page_size = 10def init(engine_settings):@@ -73,9 +83,16 @@ def request(query, params):if username and password:params['auth'] = (username, password)- params['url'] = search_url.format(base_url=base_url, index=index)+ args = {+ 'from': (params['pageno'] - 1) * page_size,+ 'size': page_size,+ }+ data = _available_query_types[query_type](query)+ data.update(args)++ params['url'] = f"{base_url}/{index}/_search"params['method'] = 'GET'- params['data'] = dumps(_available_query_types[query_type](query))+ params['data'] = dumps(data)params['headers']['Content-Type'] = 'application/json'return paramsdiff --git a/searx/settings.yml b/searx/settings.ymlindex ec6f4c1c5..770f80ea7 100644--- a/searx/settings.yml+++ b/searx/settings.yml@@ -789,17 +789,18 @@ engines:results: HTML# - name: elasticsearch- # shortcut: es+ # shortcut: els# engine: elasticsearch# base_url: http://localhost:9200# username: elastic# password: changeme# index: my-index+ # enable_http: true# # available options: match, simple_query_string, term, terms, custom# query_type: match# # if query_type is set to custom, provide your query here- # #custom_query_json: {"query":{"match_all": {}}}- # #show_metadata: false+ # # custom_query_json: {"query":{"match_all": {}}}+ # # show_metadata: false# disabled: true- name: wikidata