| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- // TODO: https://redmine.weseek.co.jp/issues/168446
- import type { estypes } from '@elastic/elasticsearch7';
- type Mappings = {
- settings: NonNullable<estypes.IndicesCreateRequest['body']>['settings'];
- mappings: NonNullable<estypes.IndicesCreateRequest['body']>['mappings'];
- }
- export const mappings: Mappings = {
- settings: {
- analysis: {
- filter: {
- english_stop: {
- type: 'stop',
- stopwords: '_english_',
- },
- },
- tokenizer: {
- edge_ngram_tokenizer: {
- type: 'edge_ngram',
- min_gram: 2,
- max_gram: 20,
- token_chars: ['letter', 'digit'],
- },
- },
- analyzer: {
- japanese: {
- type: 'custom',
- tokenizer: 'kuromoji_tokenizer',
- char_filter: ['icu_normalizer'],
- },
- english_edge_ngram: {
- type: 'custom',
- tokenizer: 'edge_ngram_tokenizer',
- filter: [
- 'lowercase',
- 'english_stop',
- ],
- },
- },
- },
- },
- mappings: {
- properties: {
- path: {
- type: 'text',
- fields: {
- raw: {
- type: 'text',
- analyzer: 'keyword',
- },
- ja: {
- type: 'text',
- analyzer: 'japanese',
- },
- en: {
- type: 'text',
- analyzer: 'english_edge_ngram',
- search_analyzer: 'standard',
- },
- },
- },
- body: {
- type: 'text',
- fields: {
- ja: {
- type: 'text',
- analyzer: 'japanese',
- },
- en: {
- type: 'text',
- analyzer: 'english_edge_ngram',
- search_analyzer: 'standard',
- },
- },
- },
- body_embedded: {
- type: 'dense_vector',
- dims: 768,
- },
- comments: {
- type: 'text',
- fields: {
- ja: {
- type: 'text',
- analyzer: 'japanese',
- },
- en: {
- type: 'text',
- analyzer: 'english_edge_ngram',
- search_analyzer: 'standard',
- },
- },
- },
- username: {
- type: 'keyword',
- },
- comment_count: {
- type: 'integer',
- },
- bookmark_count: {
- type: 'integer',
- },
- like_count: {
- type: 'integer',
- },
- grant: {
- type: 'integer',
- },
- granted_users: {
- type: 'keyword',
- },
- granted_groups: {
- type: 'keyword',
- },
- created_at: {
- type: 'date',
- format: 'dateOptionalTime',
- },
- updated_at: {
- type: 'date',
- format: 'dateOptionalTime',
- },
- tag_names: {
- type: 'keyword',
- },
- },
- },
- };
|