001package io.ebean.annotation; 002 003import java.lang.annotation.ElementType; 004import java.lang.annotation.Retention; 005import java.lang.annotation.RetentionPolicy; 006import java.lang.annotation.Target; 007 008/** 009 * Specify the entity type maps to a document store (like ElasticSearch). 010 */ 011@Target({ElementType.TYPE}) 012@Retention(RetentionPolicy.RUNTIME) 013public @interface DocStore { 014 015 /** 016 * A unique Id used when queuing reindex events. 017 */ 018 String queueId() default ""; 019 020 /** 021 * The ElasticSearch index name. If left unspecified the short name of the bean type is used. 022 */ 023 String indexName() default ""; 024 025 /** 026 * The ElasticSearch index type. If left unspecified the short name of the bean type is used. 027 */ 028 String indexType() default ""; 029 030 /** 031 * Set to false to disable the "_all" index. 032 */ 033 boolean enableAll() default true; 034 035 /** 036 * Set the refresh interval for the index. 037 */ 038 String refreshInterval() default ""; 039 040 /** 041 * The number of shards this index should use. 042 */ 043 int shards() default 0; 044 045 /** 046 * The number of replicas this index should use. 047 */ 048 int replicas() default 0; 049 050 /** 051 * Additional mapping that can be defined on the properties. 052 */ 053 DocMapping[] mapping() default {}; 054 055 /** 056 * Specify the behavior when bean Insert, Update, Delete events occur. 057 */ 058 DocStoreMode persist() default DocStoreMode.DEFAULT; 059 060 /** 061 * Specify the behavior when bean Insert occurs. 062 */ 063 DocStoreMode insert() default DocStoreMode.DEFAULT; 064 065 /** 066 * Specify the behavior when bean Update occurs. 067 */ 068 DocStoreMode update() default DocStoreMode.DEFAULT; 069 070 /** 071 * Specify the behavior when bean Delete occurs. 072 */ 073 DocStoreMode delete() default DocStoreMode.DEFAULT; 074 075 /** 076 * Specify to include only some properties in the doc store document. 077 * <p> 078 * If this is left as default then all scalar properties are included, 079 * all @ManyToOne properties are included with just the nested id property 080 * and no @OneToMany properties are included. 081 * </p> 082 * <p> 083 * Note that typically DocStoreEmbedded is used on @ManyToOne and @OneToMany 084 * properties to indicate what part of the nested document should be included. 085 * </p> 086 * <h3>Example:</h3> 087 * <pre>{@code 088 * 089 * // only include the customer id and name 090 * @DocStore(doc = "id,name") 091 * @Entity @Table(name = "o_order") 092 * public class Customer { 093 * 094 * }</pre> 095 */ 096 String doc() default ""; 097}