001package com.avaje.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 * The number of shards this index should use. 032 */ 033 int shards() default 0; 034 035 /** 036 * The number of replicas this index should use. 037 */ 038 int replicas() default 0; 039 040 /** 041 * Additional mapping that can be defined on the properties. 042 */ 043 DocMapping[] mapping() default {}; 044 045 /** 046 * Specify the behavior when bean Insert, Update, Delete events occur. 047 */ 048 DocStoreMode persist() default DocStoreMode.DEFAULT; 049 050 /** 051 * Specify the behavior when bean Insert occurs. 052 */ 053 DocStoreMode insert() default DocStoreMode.DEFAULT; 054 055 /** 056 * Specify the behavior when bean Update occurs. 057 */ 058 DocStoreMode update() default DocStoreMode.DEFAULT; 059 060 /** 061 * Specify the behavior when bean Delete occurs. 062 */ 063 DocStoreMode delete() default DocStoreMode.DEFAULT; 064 065 /** 066 * Specify to include only some properties in the doc store document. 067 * <p> 068 * If this is left as default then all scalar properties are included, 069 * all @ManyToOne properties are included with just the nested id property 070 * and no @OneToMany properties are included. 071 * </p> 072 * <p> 073 * Note that typically DocStoreEmbedded is used on @ManyToOne and @OneToMany 074 * properties to indicate what part of the nested document should be included. 075 * </p> 076 * 077 * <h3>Example:</h3> 078 * <pre>{@code 079 * 080 * // only include the customer id and name 081 * @DocStore(doc = "id,name") 082 * @Entity @Table(name = "o_order") 083 * public class Customer { 084 * 085 * }</pre> 086 */ 087 String doc() default ""; 088}