Skip to content

Commit 0306873

Browse files
ali kamaliparazit-IR
authored andcommitted
Add Talk and Speaker nested documents
Signed-off-by: Mohammadali Jalalkamali <m.ali.jalalkamali@gmail.com>
1 parent 05c8bec commit 0306873

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package example.springdata.elasticsearch.speaker;
2+
3+
import lombok.Builder;
4+
import lombok.Data;
5+
6+
/**
7+
* Speaker of a talk.
8+
*/
9+
@Data
10+
@Builder
11+
public class Speaker {
12+
13+
/**
14+
* Speaker name.
15+
*/
16+
private String name;
17+
18+
/**
19+
* Speaker position.
20+
*/
21+
private String position;
22+
}
23+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Domain classes for speaker examples in Spring Data Elasticsearch.
3+
*/
4+
package example.springdata.elasticsearch.speaker;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package example.springdata.elasticsearch.talk;
2+
3+
import example.springdata.elasticsearch.speaker.Speaker;
4+
5+
import java.util.List;
6+
7+
import lombok.Builder;
8+
import lombok.Data;
9+
import org.springframework.data.annotation.Id;
10+
import org.springframework.data.elasticsearch.annotations.Document;
11+
import org.springframework.data.elasticsearch.annotations.Field;
12+
import org.springframework.data.elasticsearch.annotations.FieldType;
13+
14+
/**
15+
* Elasticsearch talk document.
16+
*/
17+
@Data
18+
@Builder
19+
@Document(indexName = "talks")
20+
public class Talk {
21+
22+
/**
23+
* Document id.
24+
*/
25+
@Id
26+
private String id;
27+
28+
/**
29+
* Talk title.
30+
*/
31+
private String title;
32+
33+
/**
34+
* Speakers of this talk.
35+
*/
36+
@Field(type = FieldType.Nested)
37+
private List<Speaker> speakers;
38+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Domain classes for talk examples in Spring Data Elasticsearch.
3+
*/
4+
package example.springdata.elasticsearch.talk;

0 commit comments

Comments
 (0)