Files
openstapps/packages/es-mapping-generator/src/config/fieldmap.ts

77 lines
1.8 KiB
TypeScript

/*
* Copyright (C) 2019-2021 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {MappingProperty} from '@elastic/elasticsearch/lib/api/types';
import type {ElasticsearchFieldmap, SimpleType} from '../../schema/mappings.js';
const ducetSort = {
type: 'icu_collation_keyword',
language: 'de',
country: 'DE',
variant: '@collation=phonebook',
};
const keyword: MappingProperty['type'] = 'keyword';
export const fieldmap: ElasticsearchFieldmap = {
aggregatable: {
default: {
raw: {
ignore_above: 10_000,
type: keyword,
},
},
ignore: ['global'],
},
sortable: {
default: {
sort: ducetSort,
},
ducet: {
sort: ducetSort,
},
ignore: ['price'],
},
suggestable: {
default: {
trigram: {
type: 'text',
analyzer: 'trigram',
},
reverse: {
type: 'text',
analyzer: 'reverse',
},
},
ignore: [],
},
completable: {
default: {
completion: {
type: 'search_as_you_type',
},
},
ignore: [],
},
};
export const filterableTagName = 'filterable';
export const filterableMap: Record<string, SimpleType> = {
date: 'keyword',
keyword: 'keyword',
text: 'keyword',
integer: 'integer',
};