aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMario Jansen <mario@hosting2go.nl>2023-06-23 13:59:50 +0200
committerMario Jansen <mario@hosting2go.nl>2023-06-23 13:59:50 +0200
commit96a9b8b2696f96f9d3046935811cf783e4b52a05 (patch)
tree10c64758f2ee6f60f61236fdf82572e0327bab5a /src
parent73616c41916dbb0f76bd7f1275424ad5e84af154 (diff)
downloadrspamd-96a9b8b2696f96f9d3046935811cf783e4b52a05.tar.gz
rspamd-96a9b8b2696f96f9d3046935811cf783e4b52a05.zip
if elasticsearch_version >= 7 we should not send the _type to elasticsearch, deprecated in es 7, obsolete in es 8
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/elastic.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/lua/elastic.lua b/src/plugins/lua/elastic.lua
index b93186f9a..ce2d01b80 100644
--- a/src/plugins/lua/elastic.lua
+++ b/src/plugins/lua/elastic.lua
@@ -57,6 +57,7 @@ local settings = {
no_ssl_verify = false,
max_fail = 3,
ingest_module = false,
+ elasticsearch_version = 6,
}
local function read_file(path)
@@ -71,8 +72,13 @@ local function elastic_send_data(task)
local es_index = os.date(settings['index_pattern'])
local tbl = {}
for _,value in pairs(rows) do
- table.insert(tbl, '{ "index" : { "_index" : "'..es_index..
- '", "_type" : "_doc" ,"pipeline": "rspamd-geoip"} }')
+ if settings.elasticsearch_version >= 7 then
+ table.insert(tbl, '{ "index" : { "_index" : "'..es_index..
+ '","pipeline": "rspamd-geoip"} }')
+ else
+ table.insert(tbl, '{ "index" : { "_index" : "'..es_index..
+ '", "_type" : "_doc" ,"pipeline": "rspamd-geoip"} }')
+ end
table.insert(tbl, ucl.to_format(value, 'json-compact'))
end