mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-17 20:46:11 +00:00
fix ES import from live (#29)
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/29
This commit is contained in:
parent
40bec73db6
commit
2937495712
|
@ -874,7 +874,7 @@ config :pleroma, Pleroma.Search.Elasticsearch.Cluster,
|
||||||
settings: "priv/es-mappings/activity.json",
|
settings: "priv/es-mappings/activity.json",
|
||||||
store: Pleroma.Search.Elasticsearch.Store,
|
store: Pleroma.Search.Elasticsearch.Store,
|
||||||
sources: [Pleroma.Activity],
|
sources: [Pleroma.Activity],
|
||||||
bulk_page_size: 5000,
|
bulk_page_size: 1000,
|
||||||
bulk_wait_interval: 15_000
|
bulk_wait_interval: 15_000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,10 +154,10 @@ To start the initial indexing, run the `build` command:
|
||||||
|
|
||||||
=== "OTP"
|
=== "OTP"
|
||||||
```sh
|
```sh
|
||||||
./bin/pleroma_ctl search.elasticsearch index activities --cluster Pleroma.Search.Elasticsearch.Cluster
|
./bin/pleroma_ctl search import activities
|
||||||
```
|
```
|
||||||
|
|
||||||
=== "From Source"
|
=== "From Source"
|
||||||
```sh
|
```sh
|
||||||
mix elasticsearch.build activities --cluster Pleroma.Search.Elasticsearch.Cluster
|
mix pleroma.search import activities
|
||||||
```
|
```
|
|
@ -57,7 +57,8 @@ defmodule Mix.Pleroma do
|
||||||
{Majic.Pool,
|
{Majic.Pool,
|
||||||
[name: Pleroma.MajicPool, pool_size: Pleroma.Config.get([:majic_pool, :size], 2)]}
|
[name: Pleroma.MajicPool, pool_size: Pleroma.Config.get([:majic_pool, :size], 2)]}
|
||||||
] ++
|
] ++
|
||||||
http_children(adapter)
|
http_children(adapter) ++
|
||||||
|
elasticsearch_children()
|
||||||
|
|
||||||
cachex_children = Enum.map(@cachex_children, &Pleroma.Application.build_cachex(&1, []))
|
cachex_children = Enum.map(@cachex_children, &Pleroma.Application.build_cachex(&1, []))
|
||||||
|
|
||||||
|
@ -136,4 +137,14 @@ defmodule Mix.Pleroma do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp http_children(_), do: []
|
defp http_children(_), do: []
|
||||||
|
|
||||||
|
def elasticsearch_children do
|
||||||
|
config = Pleroma.Config.get([Pleroma.Search, :module])
|
||||||
|
|
||||||
|
if config == Pleroma.Search.Elasticsearch do
|
||||||
|
[Pleroma.Search.Elasticsearch.Cluster]
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
20
lib/mix/tasks/pleroma/search.ex
Normal file
20
lib/mix/tasks/pleroma/search.ex
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# Pleroma: A lightweight social networking server
|
||||||
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
defmodule Mix.Tasks.Pleroma.Search do
|
||||||
|
use Mix.Task
|
||||||
|
import Mix.Pleroma
|
||||||
|
|
||||||
|
@shortdoc "Manages elasticsearch"
|
||||||
|
|
||||||
|
def run(["import", "activities" | _rest]) do
|
||||||
|
start_pleroma()
|
||||||
|
|
||||||
|
Elasticsearch.Index.Bulk.upload(
|
||||||
|
Pleroma.Search.Elasticsearch.Cluster,
|
||||||
|
"activities",
|
||||||
|
Pleroma.Config.get([Pleroma.Search.Elasticsearch.Cluster, :indexes, :activities])
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,9 +0,0 @@
|
||||||
defmodule Mix.Tasks.Pleroma.Search.Elasticsearch do
|
|
||||||
alias Mix.Tasks.Elasticsearch.Build
|
|
||||||
import Mix.Pleroma
|
|
||||||
|
|
||||||
def run(["index" | args]) do
|
|
||||||
start_pleroma()
|
|
||||||
Build.run(args)
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in a new issue