From 146b693e4abf28e3deabdb4c01a203919db07c25 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Wed, 27 Jan 2021 02:56:43 -0300 Subject: [PATCH] exclude title and description --- lbry/wallet/server/db/elastic_search.py | 1 + scripts/sync.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lbry/wallet/server/db/elastic_search.py b/lbry/wallet/server/db/elastic_search.py index ff599b5f6..ee3048a12 100644 --- a/lbry/wallet/server/db/elastic_search.py +++ b/lbry/wallet/server/db/elastic_search.py @@ -332,6 +332,7 @@ def expand_query(**kwargs): "claim_name^4", "channel_name^8", "title^1", "description^.5", "author^1", "tags^.5" ]}}} query = { + "_source": {"excludes": ["description", "title"]}, 'query': {'bool': query}, "sort": [], } diff --git a/scripts/sync.py b/scripts/sync.py index 69124f7f4..61b878029 100644 --- a/scripts/sync.py +++ b/scripts/sync.py @@ -41,7 +41,7 @@ WHERE claim.rowid % {shards_total} = {shard_num} async def consume(producer): es = AsyncElasticsearch() - await async_bulk(es, producer) + await async_bulk(es, producer, request_timeout=120) await es.close() @@ -50,7 +50,8 @@ async def run(args, shard): index = SearchIndex('') await index.start() await index.stop() - await consume(get_all(db.cursor(), shard, args.clients)) + producer = get_all(db.cursor(), shard, args.clients) + await asyncio.gather(*(consume(producer) for _ in range(min(8, args.clients)))) def __run(args, shard): asyncio.run(run(args, shard))