wildduck/indexes.yaml

542 lines
9.7 KiB
YAML
Raw Normal View History

---
2017-09-26 14:58:37 +08:00
collections:
# create following collections with specific options
- collection: messages
options:
storageEngine:
wiredTiger:
configString: block_compressor=zlib
- collection: attachments.files
type: gridfs
options:
storageEngine:
wiredTiger:
configString: block_compressor=zlib
- collection: attachments.chunks
type: gridfs
options:
storageEngine:
wiredTiger:
configString: block_compressor=zlib
indexes:
# Indexes for the user collection
- collection: users
type: users # index applies to users database
index:
name: users
key:
username: 1
2017-07-31 15:59:18 +08:00
- collection: users
type: users # index applies to users database
index:
name: users_dotless
unique: true
key:
unameview: 1
2017-11-15 21:59:37 +08:00
- collection: users
type: users # index applies to users database
index:
name: show_new
key:
created: -1
2017-11-15 21:59:37 +08:00
2017-11-03 20:11:59 +08:00
- collection: users
type: users # index applies to users database
index:
2017-11-03 20:18:04 +08:00
name: users_tags
2017-11-03 20:11:59 +08:00
key:
tagsview: 1
sparse: true
# Indexes for the addresses collection
- collection: addresses
type: users # index applies to users database
index:
2018-01-08 22:23:24 +08:00
name: address_dotless
unique: true
key:
2018-01-08 22:23:24 +08:00
addrview: 1
2017-11-15 21:59:37 +08:00
2018-01-16 18:37:18 +08:00
- collection: addresses
type: users # index applies to users database
index:
name: address_tags
key:
tagsview: 1
sparse: true
2017-07-31 15:59:18 +08:00
- collection: addresses
type: users # index applies to users database
index:
2018-01-08 22:23:24 +08:00
name: address_paging
2017-07-31 15:59:18 +08:00
key:
addrview: 1
2017-09-04 20:38:22 +08:00
_id: 1
2017-11-15 21:59:37 +08:00
- collection: addresses
type: users # index applies to users database
index:
name: user
key:
user: 1
2017-12-01 21:04:32 +08:00
# Indexes for the domainaliases collection
- collection: domainaliases
type: users # index applies to users database
index:
name: domainalias
unique: true
key:
alias: 1
- collection: domainaliases
type: users # index applies to users database
index:
name: domainlist
key:
domain: 1
2017-07-24 21:44:08 +08:00
# Indexes for the application specific passwords collection
- collection: asps
type: users # index applies to users database
index:
2017-11-17 19:37:53 +08:00
name: asps_user
2017-07-24 21:44:08 +08:00
key:
user: 1
# Indexes for the authentication log collection
- collection: authlog
type: users # index applies to users database
index:
name: user
key:
user: 1
2018-08-15 03:45:18 +08:00
_id: -1 # sort newer first
- collection: authlog
type: users # index applies to users database
index:
name: insert
key:
user: 1
created: 1
key: 1
2017-07-30 23:07:35 +08:00
2017-11-23 17:51:37 +08:00
- collection: authlog
type: users # index applies to users database
index:
2018-08-15 04:03:12 +08:00
name: user_by_ip
2017-11-23 17:51:37 +08:00
key:
user: 1
2018-08-15 04:03:12 +08:00
ip: 1 # List events for user by IP
2017-11-23 17:51:37 +08:00
_id: -1
2018-08-15 04:03:12 +08:00
partialFilterExpression:
ip: true
2017-11-23 17:51:37 +08:00
- collection: authlog
type: users # index applies to users database
index:
name: by_ip
key:
2018-08-15 04:03:12 +08:00
ip: 1 # All events from this IP
2017-11-23 17:51:37 +08:00
sparse: true
2017-11-09 03:29:10 +08:00
- collection: authlog
type: users # index applies to users database
index:
2017-11-09 03:33:50 +08:00
name: user_hashed
2017-11-09 03:29:10 +08:00
key:
2018-08-15 03:45:18 +08:00
user: hashed # sharding
2017-11-09 03:29:10 +08:00
2017-07-24 21:44:08 +08:00
- collection: authlog
type: users # index applies to users database
index:
name: entry_autoexpire
2017-08-08 18:20:03 +08:00
# autoremove log entries after expire days
expireAfterSeconds: 0
2017-07-24 21:44:08 +08:00
key:
2017-08-08 18:20:03 +08:00
expires: 1
2017-07-24 21:44:08 +08:00
# Indexes for the filters collection
- collection: filters
index:
name: user
key:
user: 1
2017-07-30 23:07:35 +08:00
# Indexes for the autoreply collection
- collection: autoreplies
index:
2017-11-15 21:59:37 +08:00
name: autoreply
2017-07-30 23:07:35 +08:00
key:
user: 1
2017-11-15 21:59:37 +08:00
start: 1
end: 1
2017-07-30 23:07:35 +08:00
# Indexes for the mailboxes collection
2017-11-15 21:59:37 +08:00
# note: should mailboxes collection be sharded? could be by user
- collection: mailboxes
index:
2017-07-30 23:07:35 +08:00
name: user_path
unique: true
key:
user: 1
path: 1
2017-11-15 21:59:37 +08:00
- collection: mailboxes
index:
name: user_subscribed
key:
user: 1
subscribed: 1
2017-11-15 21:59:37 +08:00
- collection: mailboxes
index:
name: find_by_type
key:
user: 1
specialUse: 1
# Indexes for the messages collection
2017-11-15 21:59:37 +08:00
- collection: messages
index:
# several message related queries include the shard key values
name: mailbox_uid_shard
key:
_id: 1
mailbox: 1
uid: 1
- collection: messages
index:
name: user_messages_by_thread
key:
user: 1
thread: 1
2017-11-15 21:59:37 +08:00
- collection: messages
index:
# use also as sharding key
name: mailbox_uid
key:
mailbox: 1
uid: 1
2017-07-21 16:19:59 +08:00
_id: 1
2017-11-15 21:59:37 +08:00
2017-07-21 16:19:59 +08:00
- collection: messages
index:
name: mailbox_uid_reverse
key:
mailbox: 1
uid: -1
_id: -1
- collection: messages
index:
name: mailbox_modseq_uid
key:
mailbox: 1
modseq: 1
uid: 1
2017-11-15 21:59:37 +08:00
- collection: messages
index:
name: mailbox_flags
key:
mailbox: 1
flags: 1
2017-11-15 21:59:37 +08:00
- collection: messages
index:
name: by_idate
key:
mailbox: 1
idate: 1
2017-11-15 21:59:37 +08:00
2018-01-16 18:37:18 +08:00
- collection: messages
index:
name: by_idate_reverse
key:
mailbox: 1
idate: -1
- collection: messages
index:
name: by_hdate
key:
mailbox: 1
hdate: 1
msgid: 1
2017-11-15 21:59:37 +08:00
- collection: messages
index:
name: by_size
key:
mailbox: 1
size: 1
2017-11-15 21:59:37 +08:00
- collection: messages
index:
name: by_headers
key:
mailbox: 1
headers.key: 1
headers.value: 1
2017-11-15 21:59:37 +08:00
- collection: messages
index:
# there can be only one $text index per collection
name: fulltext
key:
user: 1
2017-07-21 18:10:51 +08:00
headers.value: text
text: text
2017-11-13 21:27:37 +08:00
partialFilterExpression:
searchable: true
2017-11-15 21:59:37 +08:00
- collection: messages
index:
# in most cases we only care about unseen, not seen messages
name: mailbox_unseen_flag
key:
mailbox: 1
unseen: 1
2017-11-15 21:59:37 +08:00
2017-11-19 20:18:23 +08:00
- collection: messages
index:
name: user_unseen_flag
key:
user: 1
unseen: 1
partialFilterExpression:
searchable: true
- collection: messages
index:
# some mail agents list messages that do not have the \Deleted flag set
name: mailbox_undeleted_flag
key:
mailbox: 1
undeleted: 1
2017-11-15 21:59:37 +08:00
- collection: messages
index:
name: mailbox_flagged_flag
key:
mailbox: 1
flagged: 1
2017-11-15 21:59:37 +08:00
2017-11-19 20:18:23 +08:00
- collection: messages
index:
name: user_flagged_flag
key:
user: 1
flagged: 1
2018-01-17 20:19:48 +08:00
- collection: messages
index:
name: user_searchable_flag
key:
user: 1
searchable: 1
- collection: messages
index:
name: mailbox_draft_flag
key:
mailbox: 1
draft: 1
2017-11-15 21:59:37 +08:00
- collection: messages
index:
name: has_attachment
key:
mailbox: 1
ha: 1
2017-11-15 21:59:37 +08:00
- collection: messages
index:
# This filter finds all messages that are expired and must be deleted.
# Not sure about performance though as it is a global query
name: retention_time
partialFilterExpression:
exp: true
key:
exp: 1
rdate: 1
2017-11-17 19:37:53 +08:00
# indexes for deleted messages
- collection: archived
index:
name: user_messages
key:
user: 1
_id: 1
# indexes for deleted messages
- collection: archived
index:
name: user_messages_desc
key:
user: 1
_id: -1
- collection: archived
index:
name: retention_time
partialFilterExpression:
exp: true
key:
exp: 1
rdate: 1
# Indexes for the attachments collection
# attachments.files collection should be sharded by _id (hash)
# attachments.chunks collection should be sharded by files_id (hash)
- collection: attachments.files
type: gridfs # index applies to gridfs database
index:
name: attachment_id_hashed
key:
_id: hashed
2017-11-15 21:59:37 +08:00
- collection: attachments.files
type: gridfs # index applies to gridfs database
index:
name: related_attachments
key:
metadata.c: 1
metadata.m: 1
2017-11-15 21:59:37 +08:00
- collection: attachments.chunks
type: gridfs # index applies to gridfs database
index:
# hashed index needed for sharding
name: chunks_shard
key:
files_id: hashed
2017-11-15 21:59:37 +08:00
2017-11-08 17:02:30 +08:00
- collection: attachments.chunks
type: gridfs # index applies to gridfs database
index:
name: files_id_1_n_1
unique: true
key:
files_id: 1
n: 1
2017-12-28 19:45:02 +08:00
# Indexes for the DKIm collection
- collection: dkim
index:
name: dkim_paging
key:
domain: 1
_id: 1
- collection: dkim
index:
2017-12-28 21:16:42 +08:00
name: dkim_primary
2017-12-28 19:45:02 +08:00
unique: true
key:
domain: 1
# Indexes for the journal collection
- collection: journal
index:
# this index is used to apply changes in a mailbox for IMAP session
name: mailbox_modseq
key:
mailbox: 1
modseq: 1
2017-11-15 21:59:37 +08:00
- collection: journal
index:
# this index is used to send updates to a logged in webmail user
name: user_limit_id
key:
user: 1
_id: 1
2017-11-15 21:59:37 +08:00
- collection: journal
index:
# this index is used to find the latest journal entry
name: user_limit_id_reverse
key:
user: 1
_id: -1
2017-11-15 21:59:37 +08:00
- collection: journal
2017-07-19 16:06:47 +08:00
# delete journal entries after 3 hours
index:
2017-07-19 16:06:47 +08:00
name: journal_autoexpire
expireAfterSeconds: 10800
key:
created: 1
# Indexes for the threads collection
- collection: threads
index:
name: thread_shard
key:
user: hashed
2017-11-15 21:59:37 +08:00
- collection: threads
index:
name: thread
key:
user: 1
ids: 1
2017-11-15 21:59:37 +08:00
- collection: threads
index:
2017-07-24 21:44:08 +08:00
name: thread_autoexpire
2017-07-19 16:06:47 +08:00
# autoremove thread indexes after 180 days of inactivity
expireAfterSeconds: 15552000
key:
updated: 1
2017-09-18 22:10:35 +08:00
2017-10-20 18:43:44 +08:00
# messagelog
- collection: messagelog
index:
name: messagelog_id_hashed
key:
id: hashed
2017-10-27 16:50:37 +08:00
2017-10-27 17:30:13 +08:00
- collection: messagelog
index:
name: messagelog_parent
key:
parentId: 1
2017-11-15 21:59:37 +08:00
sparse: true # only messages inserted by mail store have parentId set
2017-10-27 17:30:13 +08:00
2018-09-28 16:56:28 +08:00
- collection: messagelog
index:
name: messagelog_queue
key:
queueId: 1
sparse: true # only messages inserted by mail store have queueId set
2017-10-23 19:04:29 +08:00
- collection: messagelog
2017-10-20 18:43:44 +08:00
index:
name: messagelog_autoexpire
# autoremove messagelog entries after 180 days
expireAfterSeconds: 15552000
key:
created: 1