From 3485f9b1c8ec6a054b4437422e20c0a8655e9da9 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 11 Nov 2021 20:57:28 +0700 Subject: [PATCH] define playlist field types in index --- tubearchivist/home/src/index_management.py | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tubearchivist/home/src/index_management.py b/tubearchivist/home/src/index_management.py index 0c87055..acd06f9 100644 --- a/tubearchivist/home/src/index_management.py +++ b/tubearchivist/home/src/index_management.py @@ -108,7 +108,30 @@ INDEX_CONFIG = [ "published": {"type": "date"}, "playlist": { "properties": { + "playlist_id": {"type": "keyword"}, "playlist_description": {"type": "text"}, + "playlist_name": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256, + "normalizer": "to_lower", + } + }, + }, + "playlist_channel": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256, + "normalizer": "to_lower", + } + }, + }, + "playlist_channel_id": {"type": "keyword"}, + "playlist_thumbnail": {"type": "keyword"}, } }, "playlist_position": { @@ -172,9 +195,37 @@ INDEX_CONFIG = [ { "index_name": "playlist", "expected_map": { + "playlist_id": {"type": "keyword"}, "playlist_description": {"type": "text"}, + "playlist_name": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256, + "normalizer": "to_lower", + } + }, + }, + "playlist_channel": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256, + "normalizer": "to_lower", + } + }, + }, + "playlist_channel_id": {"type": "keyword"}, + "playlist_thumbnail": {"type": "keyword"}, }, "expected_set": { + "analysis": { + "normalizer": { + "to_lower": {"type": "custom", "filter": ["lowercase"]} + } + }, "number_of_replicas": "0", }, },