add timeouts
authorFloatingGhost <hannah@coffee-and-dreams.uk>
Tue, 14 Dec 2021 14:33:34 +0000 (14:33 +0000)
committerFloatingGhost <hannah@coffee-and-dreams.uk>
Tue, 14 Dec 2021 14:33:34 +0000 (14:33 +0000)
lib/pleroma/search/elasticsearch.ex

index e770fe536da5be1f33965ea636413c2a62357f12..00ae6b3dccacd4fc19b846f83092b9e426c4e307 100644 (file)
@@ -9,6 +9,12 @@ defmodule Pleroma.Search.Elasticsearch do
 
   defp es_query(:activity, query) do
     %{
+      size: 50,
+      terminate_after: 50,
+      timeout: "5s",
+      sort: [
+        %{"_timestamp" => "desc"}
+      ],
       query: %{
         bool: %{
           must: Parsers.Activity.parse(query)
@@ -19,6 +25,9 @@ defmodule Pleroma.Search.Elasticsearch do
 
   defp es_query(:user, query) do
     %{
+      size: 50,
+      terminate_after: 50,
+      timeout: "5s",
       query: %{
         bool: %{
           must: Parsers.User.parse(query)
@@ -29,6 +38,9 @@ defmodule Pleroma.Search.Elasticsearch do
 
   defp es_query(:hashtag, query) do
     %{
+      size: 50,
+      terminate_after: 50,
+      timeout: "5s",
       query: %{
         bool: %{
           must: Parsers.Hashtag.parse(query)