├── .gitignore
├── .travis.yml
├── README.md
├── pom.xml
├── site
├── apidocs.zip
├── emma.zip
├── reference.zip
└── reference
│ └── pdf
│ └── spring-data-elasticsearch-reference.pdf
└── src
├── docbkx
├── index.xml
├── preface.xml
├── reference
│ ├── data-elasticsearch.xml
│ ├── elasticsearch-misc.xml
│ └── repositories.xml
└── resources
│ ├── css
│ ├── highlight.css
│ └── html.css
│ ├── images
│ ├── admons
│ │ ├── blank.png
│ │ ├── caution.gif
│ │ ├── caution.png
│ │ ├── caution.tif
│ │ ├── draft.png
│ │ ├── home.gif
│ │ ├── home.png
│ │ ├── important.gif
│ │ ├── important.png
│ │ ├── important.tif
│ │ ├── next.gif
│ │ ├── next.png
│ │ ├── note.gif
│ │ ├── note.png
│ │ ├── note.tif
│ │ ├── prev.gif
│ │ ├── prev.png
│ │ ├── tip.gif
│ │ ├── tip.png
│ │ ├── tip.tif
│ │ ├── toc-blank.png
│ │ ├── toc-minus.png
│ │ ├── toc-plus.png
│ │ ├── up.gif
│ │ ├── up.png
│ │ ├── warning.gif
│ │ ├── warning.png
│ │ └── warning.tif
│ ├── callouts
│ │ ├── 1.png
│ │ ├── 10.png
│ │ ├── 11.png
│ │ ├── 12.png
│ │ ├── 13.png
│ │ ├── 14.png
│ │ ├── 15.png
│ │ ├── 2.png
│ │ ├── 3.png
│ │ ├── 4.png
│ │ ├── 5.png
│ │ ├── 6.png
│ │ ├── 7.png
│ │ ├── 8.png
│ │ └── 9.png
│ ├── logo.png
│ └── xdev-spring_logo.jpg
│ └── xsl
│ ├── fopdf.xsl
│ ├── highlight-fo.xsl
│ ├── highlight.xsl
│ ├── html.xsl
│ └── html_chunk.xsl
├── main
├── assembly
│ ├── distribution.xml
│ └── jar-with-dependencies.descriptor.xml
├── java
│ └── org
│ │ └── springframework
│ │ └── data
│ │ └── elasticsearch
│ │ ├── ElasticsearchException.java
│ │ ├── annotations
│ │ ├── Document.java
│ │ ├── Field.java
│ │ └── Query.java
│ │ ├── client
│ │ ├── NodeClientFactoryBean.java
│ │ └── TransportClientFactoryBean.java
│ │ ├── config
│ │ ├── ElasticsearchNamespaceHandler.java
│ │ ├── NodeClientBeanDefinitionParser.java
│ │ └── TransportClientBeanDefinitionParser.java
│ │ ├── core
│ │ ├── CriteriaQueryProcessor.java
│ │ ├── ElasticsearchOperations.java
│ │ ├── ElasticsearchTemplate.java
│ │ ├── MappingBuilder.java
│ │ ├── ResultsMapper.java
│ │ ├── convert
│ │ │ ├── DateTimeConverters.java
│ │ │ ├── ElasticsearchConverter.java
│ │ │ └── MappingElasticsearchConverter.java
│ │ ├── mapping
│ │ │ ├── ElasticsearchPersistentEntity.java
│ │ │ ├── ElasticsearchPersistentProperty.java
│ │ │ ├── SimpleElasticsearchMappingContext.java
│ │ │ ├── SimpleElasticsearchPersistentEntity.java
│ │ │ └── SimpleElasticsearchPersistentProperty.java
│ │ └── query
│ │ │ ├── AbstractQuery.java
│ │ │ ├── Criteria.java
│ │ │ ├── CriteriaQuery.java
│ │ │ ├── DeleteQuery.java
│ │ │ ├── Field.java
│ │ │ ├── GetQuery.java
│ │ │ ├── IndexQuery.java
│ │ │ ├── MoreLikeThisQuery.java
│ │ │ ├── NativeSearchQuery.java
│ │ │ ├── NativeSearchQueryBuilder.java
│ │ │ ├── Query.java
│ │ │ ├── SearchQuery.java
│ │ │ ├── SimpleField.java
│ │ │ └── StringQuery.java
│ │ └── repository
│ │ ├── ElasticsearchCrudRepository.java
│ │ ├── ElasticsearchRepository.java
│ │ ├── cdi
│ │ ├── ElasticsearchRepositoryBean.java
│ │ └── ElasticsearchRepositoryExtension.java
│ │ ├── config
│ │ ├── ElasticsearchRepositoriesRegistrar.java
│ │ ├── ElasticsearchRepositoryConfigExtension.java
│ │ └── EnableElasticsearchRepositories.java
│ │ ├── query
│ │ ├── AbstractElasticsearchRepositoryQuery.java
│ │ ├── ElasticsearchPartQuery.java
│ │ ├── ElasticsearchQueryMethod.java
│ │ ├── ElasticsearchStringQuery.java
│ │ └── parser
│ │ │ └── ElasticsearchQueryCreator.java
│ │ └── support
│ │ ├── AbstractElasticsearchRepository.java
│ │ ├── ElasticsearchEntityInformation.java
│ │ ├── ElasticsearchEntityInformationCreator.java
│ │ ├── ElasticsearchEntityInformationCreatorImpl.java
│ │ ├── ElasticsearchRepositoryFactory.java
│ │ ├── ElasticsearchRepositoryFactoryBean.java
│ │ ├── MappingElasticsearchEntityInformation.java
│ │ ├── NumberKeyedRepository.java
│ │ └── SimpleElasticsearchRepository.java
└── resources
│ ├── META-INF
│ ├── services
│ │ └── javax.enterprise.inject.spi.Extension
│ ├── spring.handlers
│ ├── spring.schemas
│ └── spring.tooling
│ ├── changelog.txt
│ ├── license.txt
│ ├── notice.txt
│ └── org
│ └── springframework
│ └── data
│ └── elasticsearch
│ └── config
│ └── spring-elasticsearch-1.0.xsd
└── test
├── java
└── org
│ └── springframework
│ └── data
│ └── elasticsearch
│ ├── Author.java
│ ├── Book.java
│ ├── DoubleIDEntity.java
│ ├── IntegerIDEntity.java
│ ├── NestedObjectTest.java
│ ├── NonDocumentEntity.java
│ ├── NonDocumentEntityTest.java
│ ├── SampleEntity.java
│ ├── SampleMappingEntity.java
│ ├── config
│ ├── ElasticsearchNamespaceHandlerTest.java
│ └── EnableElasticsearchRepositoriesTest.java
│ ├── core
│ ├── ElasticsearchTemplateTest.java
│ ├── convert
│ │ ├── DateTimeConvertersTest.java
│ │ └── MappingElasticsearchConverterTest.java
│ ├── mapping
│ │ └── SimpleElasticsearchPersistentEntityTest.java
│ └── query
│ │ └── CriteriaQueryTest.java
│ ├── repositories
│ ├── CustomMethodRepositoryTest.java
│ ├── DoubleIDRepository.java
│ ├── IntegerIDRepository.java
│ ├── NonDocumentEntityRepository.java
│ ├── SampleCustomMethodRepository.java
│ ├── SampleElasticSearchBookRepository.java
│ └── SampleElasticsearchRepository.java
│ └── repository
│ └── support
│ ├── DoubleIDRepositoryTest.java
│ ├── ElasticsearchRepositoryFactoryTest.java
│ ├── IntegerIDRepositoryTest.java
│ └── SimpleElasticsearchRepositoryTest.java
└── resources
├── custom-method-repository-test.xml
├── elasticsearch-template-test.xml
├── logback.xml
├── org
└── springframework
│ └── data
│ └── elasticsearch
│ └── config
│ └── namespace.xml
├── repository-non-document-entity.xml
├── repository-test-nested-object.xml
└── simple-repository-test.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | atlassian-ide-plugin.xml
2 |
3 | ## Ignore svn files
4 | .svn
5 |
6 | target
7 |
8 | ## Ignore project files created by Eclipse
9 | .settings
10 | .project
11 | .classpath
12 |
13 | ## Ignore project files created by IntelliJ IDEA
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea
18 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Note : This Project is moved to SpringSource Repository [Spring-Data-Elasticsearch](https://github.com/SpringSource/spring-data-elasticsearch)
2 |
3 | Hence all the new changes will be pushed to new repository
4 |
5 | Thanks
6 |
7 | BioMed Central Development Team
8 |
--------------------------------------------------------------------------------
/site/apidocs.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/site/apidocs.zip
--------------------------------------------------------------------------------
/site/emma.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/site/emma.zip
--------------------------------------------------------------------------------
/site/reference.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/site/reference.zip
--------------------------------------------------------------------------------
/site/reference/pdf/spring-data-elasticsearch-reference.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/site/reference/pdf/spring-data-elasticsearch-reference.pdf
--------------------------------------------------------------------------------
/src/docbkx/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | Spring Data Elasticsearch
7 |
8 |
9 | BioMed Central
10 | Development Team
11 |
12 |
13 |
14 |
15 | Copies of this document may be made for your own use and for
16 | distribution to others, provided that you do not
17 | charge any fee for
18 | such copies and further provided that each copy
19 | contains this
20 | Copyright Notice, whether
21 | distributed in print or electronically.
22 |
23 |
24 |
25 |
26 | 2013
27 | The original author(s)
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | Reference Documentation
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Appendix
48 |
50 |
52 |
53 |
55 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/src/docbkx/preface.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | Preface
6 | The Spring Data Elasticsearch project applies core Spring concepts to
7 | the
8 | development of solutions using the Elasticsearch Search Engine.
9 | We have povided a "template" as a high-level abstraction for
10 | storing,querying,sorting and faceting documents. You will notice similarities
11 | to the Spring data solr and
12 | mongodb support in the Spring Framework.
13 |
14 |
15 | Project Metadata
16 |
17 |
18 |
19 | Version Control -
20 | git://github.com/BioMedCentralLtd/spring-data-elasticsearch.git
21 |
22 |
23 |
24 |
25 |
26 |
27 | Requirements
28 |
29 | Requires
30 | Elasticsearch
31 | 0.20.2 and above or optional dependency or not even that if you are using Embedded Node Client
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/docbkx/reference/elasticsearch-misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | Miscellaneous Elasticsearch Operation Support
6 |
7 |
8 | This chapter covers additional support for Elasticsearch operations
9 | that cannot be directly accessed via the repository
10 | interface.
11 | It is recommended to add those operations as custom
12 | implementation as
13 | described in
14 |
15 | .
16 |
17 |
18 |
19 | Filter Builder
20 |
21 | Filter Builder improves query speed.
22 |
23 |
24 |
25 | private ElasticsearchTemplate elasticsearchTemplate;
26 | SearchQuery searchQuery = new NativeSearchQueryBuilder()
27 | .withQuery(matchAllQuery())
28 | .withFilter(boolFilter().must(termFilter("id", documentId)))
29 | .build();
30 | Page<SampleEntity> sampleEntities = elasticsearchTemplate.queryForPage(searchQuery,SampleEntity.class);
31 |
32 |
33 |
34 |
83 |
--------------------------------------------------------------------------------
/src/docbkx/resources/css/highlight.css:
--------------------------------------------------------------------------------
1 | /*
2 | borrowed from: https://raw.github.com/SpringSource/spring-data-jpa/master/src/docbkx/resources/css/highlight.css
3 | code highlight CSS resemblign the Eclipse IDE default color schema
4 | @author Costin Leau
5 | */
6 |
7 | .hl-keyword {
8 | color: #7F0055;
9 | font-weight: bold;
10 | }
11 |
12 | .hl-comment {
13 | color: #3F5F5F;
14 | font-style: italic;
15 | }
16 |
17 | .hl-multiline-comment {
18 | color: #3F5FBF;
19 | font-style: italic;
20 | }
21 |
22 | .hl-tag {
23 | color: #3F7F7F;
24 | }
25 |
26 | .hl-attribute {
27 | color: #7F007F;
28 | }
29 |
30 | .hl-value {
31 | color: #2A00FF;
32 | }
33 |
34 | .hl-string {
35 | color: #2A00FF;
36 | }
--------------------------------------------------------------------------------
/src/docbkx/resources/css/html.css:
--------------------------------------------------------------------------------
1 | /*
2 | borrowed from: https://raw.github.com/SpringSource/spring-data-jpa/master/src/docbkx/resources/css/html.css
3 | */
4 |
5 | @IMPORT url("highlight.css");
6 |
7 | html {
8 | padding: 0pt;
9 | margin: 0pt;
10 | }
11 |
12 | body {
13 | margin-left: 15%;
14 | margin-right: 15%;
15 | font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
16 | }
17 |
18 | div {
19 | margin: 0pt;
20 | }
21 |
22 | p {
23 | text-align: justify;
24 | line-height: 1.3em;
25 | }
26 |
27 | hr {
28 | border: 1px solid gray;
29 | background: gray;
30 | }
31 |
32 | h1,h2,h3,h4,h5 {
33 | color: #234623;
34 | font-weight: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
35 | margin-bottom: 0em;
36 | margin-top: 2em;
37 | }
38 |
39 | pre {
40 | line-height: 1.0;
41 | color: black;
42 | }
43 |
44 | table code {
45 | font-size: 110%;
46 | }
47 |
48 | pre.programlisting {
49 | font-size: 1em;
50 | padding: 3pt 3pt;
51 | border: 1pt solid black;
52 | background: #eeeeee;
53 | clear: both;
54 | }
55 |
56 | div.table {
57 | margin: 1em;
58 | padding: 0.5em;
59 | text-align: center;
60 | }
61 |
62 | div.table table {
63 | display: table;
64 | width: 100%;
65 | }
66 |
67 | div.table td {
68 | padding-left: 7px;
69 | padding-right: 7px;
70 | }
71 |
72 | .sidebar {
73 | float: right;
74 | margin: 10px 0 10px 30px;
75 | padding: 10px 20px 20px 20px;
76 | width: 33%;
77 | border: 1px solid black;
78 | background-color: #F4F4F4;
79 | font-size: 14px;
80 | }
81 |
82 | .mediaobject {
83 | padding-top: 30px;
84 | padding-bottom: 30px;
85 | }
86 |
87 | .legalnotice {
88 | font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
89 | font-size: 12px;
90 | font-style: italic;
91 | }
92 |
93 | p.releaseinfo {
94 | font-size: 100%;
95 | font-weight: bold;
96 | font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
97 | padding-top: 10px;
98 | }
99 |
100 | p.pubdate {
101 | font-size: 120%;
102 | font-weight: bold;
103 | font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
104 | }
105 |
106 | span.productname {
107 | font-size: 200%;
108 | font-weight: bold;
109 | font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
110 | }
111 |
112 | code {
113 | font-size: 125%;
114 | }
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/blank.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/blank.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/caution.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/caution.gif
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/caution.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/caution.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/caution.tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/caution.tif
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/draft.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/draft.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/home.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/home.gif
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/home.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/important.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/important.gif
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/important.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/important.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/important.tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/important.tif
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/next.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/next.gif
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/next.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/next.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/note.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/note.gif
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/note.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/note.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/note.tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/note.tif
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/prev.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/prev.gif
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/prev.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/prev.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/tip.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/tip.gif
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/tip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/tip.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/tip.tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/tip.tif
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/toc-blank.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/toc-blank.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/toc-minus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/toc-minus.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/toc-plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/toc-plus.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/up.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/up.gif
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/up.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/warning.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/warning.gif
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/warning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/warning.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/admons/warning.tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/admons/warning.tif
--------------------------------------------------------------------------------
/src/docbkx/resources/images/callouts/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/callouts/1.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/callouts/10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/callouts/10.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/callouts/11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/callouts/11.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/callouts/12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/callouts/12.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/callouts/13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/callouts/13.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/callouts/14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/callouts/14.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/callouts/15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/callouts/15.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/callouts/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/callouts/2.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/callouts/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/callouts/3.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/callouts/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/callouts/4.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/callouts/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/callouts/5.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/callouts/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/callouts/6.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/callouts/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/callouts/7.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/callouts/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/callouts/8.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/callouts/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/callouts/9.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/logo.png
--------------------------------------------------------------------------------
/src/docbkx/resources/images/xdev-spring_logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringDataElasticsearchDevs/spring-data-elasticsearch/a73fa6142184ae4332b65b4be1f65232391e7dfa/src/docbkx/resources/images/xdev-spring_logo.jpg
--------------------------------------------------------------------------------
/src/docbkx/resources/xsl/highlight-fo.xsl:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/src/docbkx/resources/xsl/highlight.xsl:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/docbkx/resources/xsl/html.xsl:
--------------------------------------------------------------------------------
1 |
2 |
7 |
12 |
13 |
14 |
15 |
16 |
19 |
20 |
21 | 0
22 | 0
23 | 1
24 |
25 |
28 |
29 |
30 |
31 | book toc
32 |
33 |
34 |
35 | 3
36 |
37 |
40 |
41 |
42 | 1
43 |
44 |
45 |
46 |
49 |
50 |
51 | 1
52 |
53 |
54 | 90
55 |
56 |
59 |
60 |
61 | 1
62 | images/admons/
63 |
66 |
67 |
68 | figure after
69 | example before
70 | equation before
71 | table before
72 | procedure before
73 |
74 |
75 |
76 | ,
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
Authors
87 |
88 |
89 |
90 |
91 |
94 |
95 |
96 |
105 |
106 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/src/main/assembly/distribution.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 | distribution
10 |
11 | zip
12 |
13 | true
14 |
15 |
16 |
17 | src/main/resources
18 |
19 | license.txt
20 | notice.txt
21 | changelog.txt
22 |
23 |
24 | dos
25 |
26 |
27 |
30 | target/site/reference
31 | docs/reference
32 |
33 |
34 |
36 | target/site/apidocs
37 | docs/javadoc
38 |
39 |
40 |
41 |
42 | target/${dist.finalName}.jar
43 | dist
44 | 0644
45 |
46 |
47 | target/${dist.finalName}-sources.jar
48 | sources
49 | 0644
50 |
51 |
52 |
--------------------------------------------------------------------------------
/src/main/assembly/jar-with-dependencies.descriptor.xml:
--------------------------------------------------------------------------------
1 |
4 | all
5 |
6 | jar
7 |
8 | false
9 |
10 |
11 | /
12 | true
13 | true
14 | runtime
15 | true
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/main/java/org/springframework/data/elasticsearch/ElasticsearchException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.elasticsearch;
17 |
18 |
19 | import java.util.Map;
20 |
21 | /**
22 | * ElasticsearchException
23 | *
24 | * @author Rizwan Idrees
25 | * @author Mohsin Husen
26 | */
27 | public class ElasticsearchException extends RuntimeException{
28 |
29 | private Map failedDocuments;
30 |
31 | public ElasticsearchException(String message) {
32 | super(message);
33 | }
34 |
35 | public ElasticsearchException(String message, Throwable cause) {
36 | super(message, cause);
37 | }
38 |
39 | public ElasticsearchException(String message, Throwable cause, Map failedDocuments) {
40 | super(message, cause);
41 | this.failedDocuments = failedDocuments;
42 | }
43 |
44 | public ElasticsearchException(String message, Map failedDocuments) {
45 | super(message);
46 | this.failedDocuments = failedDocuments;
47 | }
48 |
49 | public Map getFailedDocuments() {
50 | return failedDocuments;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/org/springframework/data/elasticsearch/annotations/Document.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.springframework.data.elasticsearch.annotations;
18 |
19 |
20 | import org.springframework.data.annotation.Persistent;
21 |
22 | import java.lang.annotation.*;
23 |
24 | /**
25 | * Document
26 | *
27 | * @author Rizwan Idrees
28 | * @author Mohsin Husen
29 | */
30 |
31 | @Persistent
32 | @Inherited
33 | @Retention(RetentionPolicy.RUNTIME)
34 | @Target({ ElementType.TYPE })
35 | public @interface Document {
36 |
37 | String indexName();
38 | String type() default "";
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/org/springframework/data/elasticsearch/annotations/Field.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.springframework.data.elasticsearch.annotations;
18 |
19 | import java.lang.annotation.*;
20 |
21 |
22 | /**
23 | * @author Rizwan Idrees
24 | * @author Mohsin Husen
25 | */
26 | @Retention(RetentionPolicy.RUNTIME)
27 | @Target(ElementType.FIELD)
28 | @Documented
29 | public @interface Field {
30 |
31 | String type() default "";
32 | String index() default "";
33 | boolean store() default true;
34 | String searchAnalyzer() default "";
35 | String indexAnalyzer() default "";
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/org/springframework/data/elasticsearch/annotations/Query.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.elasticsearch.annotations;
17 |
18 | import java.lang.annotation.*;
19 |
20 | /**
21 | * Query
22 | *
23 | * @author Rizwan Idrees
24 | * @author Mohsin Husen
25 | */
26 |
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Target(ElementType.METHOD)
29 | @Documented
30 | public @interface Query {
31 |
32 | /**
33 | * Elasticsearch query to be used when executing query. May contain placeholders eg. ?0
34 | *
35 | * @return
36 | */
37 | String value() default "";
38 |
39 | /**
40 | * Named Query Named looked up by repository.
41 | *
42 | * @return
43 | */
44 | String name() default "";
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/org/springframework/data/elasticsearch/client/NodeClientFactoryBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.elasticsearch.client;
17 |
18 | import org.elasticsearch.client.Client;
19 | import org.elasticsearch.client.node.NodeClient;
20 | import org.springframework.beans.factory.FactoryBean;
21 | import org.springframework.beans.factory.InitializingBean;
22 |
23 | import static org.elasticsearch.node.NodeBuilder.nodeBuilder;
24 |
25 | /**
26 | * NodeClientFactoryBean
27 | *
28 | * @author Rizwan Idrees
29 | * @author Mohsin Husen
30 | */
31 |
32 | public class NodeClientFactoryBean implements FactoryBean, InitializingBean{
33 |
34 | private boolean local;
35 | private NodeClient nodeClient;
36 |
37 | NodeClientFactoryBean() {
38 | }
39 |
40 | public NodeClientFactoryBean(boolean local) {
41 | this.local = local;
42 | }
43 |
44 | @Override
45 | public NodeClient getObject() throws Exception {
46 | return nodeClient;
47 | }
48 |
49 | @Override
50 | public Class extends Client> getObjectType() {
51 | return NodeClient.class;
52 | }
53 |
54 | @Override
55 | public boolean isSingleton() {
56 | return true;
57 | }
58 |
59 | @Override
60 | public void afterPropertiesSet() throws Exception {
61 | nodeClient = (NodeClient) nodeBuilder().local(this.local).node().client();
62 | }
63 |
64 | public void setLocal(boolean local) {
65 | this.local = local;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/org/springframework/data/elasticsearch/client/TransportClientFactoryBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.springframework.data.elasticsearch.client;
18 |
19 | import org.elasticsearch.client.transport.TransportClient;
20 | import org.elasticsearch.common.settings.Settings;
21 | import org.elasticsearch.common.transport.InetSocketTransportAddress;
22 | import org.slf4j.Logger;
23 | import org.slf4j.LoggerFactory;
24 | import org.springframework.beans.factory.DisposableBean;
25 | import org.springframework.beans.factory.FactoryBean;
26 | import org.springframework.beans.factory.InitializingBean;
27 | import org.springframework.util.Assert;
28 |
29 | import java.util.Properties;
30 |
31 | import static org.apache.commons.lang.StringUtils.substringAfter;
32 | import static org.apache.commons.lang.StringUtils.substringBefore;
33 | import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
34 |
35 | /**
36 | * TransportClientFactoryBean
37 | *
38 | * @author Rizwan Idrees
39 | * @author Mohsin Husen
40 | */
41 |
42 | public class TransportClientFactoryBean implements FactoryBean, InitializingBean, DisposableBean {
43 |
44 | private static final Logger logger = LoggerFactory.getLogger(TransportClientFactoryBean.class);
45 | private String[] clusterNodes;
46 | private TransportClient client;
47 | private Properties properties;
48 | static final String COLON = ":";
49 |
50 | @Override
51 | public void destroy() throws Exception {
52 | try {
53 | logger.info("Closing elasticSearch client");
54 | if (client != null) {
55 | client.close();
56 | }
57 | } catch (final Exception e) {
58 | logger.error("Error closing ElasticSearch client: ", e);
59 | }
60 | }
61 |
62 | @Override
63 | public TransportClient getObject() throws Exception {
64 | return client;
65 | }
66 |
67 | @Override
68 | public Class getObjectType() {
69 | return TransportClient.class;
70 | }
71 |
72 | @Override
73 | public boolean isSingleton() {
74 | return false;
75 | }
76 |
77 | @Override
78 | public void afterPropertiesSet() throws Exception {
79 | buildClient();
80 | }
81 |
82 | protected void buildClient() throws Exception {
83 | client = new TransportClient(settings());
84 | Assert.notEmpty(clusterNodes,"[Assertion failed] clusterNodes settings missing.");
85 | for (String clusterNode : clusterNodes) {
86 | String hostName = substringBefore(clusterNode, COLON);
87 | String port = substringAfter(clusterNode, COLON);
88 | Assert.hasText(hostName,"[Assertion failed] missing host name in 'clusterNodes'");
89 | Assert.hasText(port,"[Assertion failed] missing port in 'clusterNodes'");
90 | logger.info("adding transport node : " + clusterNode);
91 | client.addTransportAddress(new InetSocketTransportAddress(hostName, Integer.valueOf(port)));
92 | }
93 | client.connectedNodes();
94 | }
95 |
96 | private Settings settings(){
97 | if(properties != null){
98 | return settingsBuilder().put(properties).build();
99 | }
100 | return settingsBuilder()
101 | .put("client.transport.sniff",true).build();
102 | }
103 |
104 | public void setClusterNodes(String[] clusterNodes) {
105 | this.clusterNodes = clusterNodes;
106 | }
107 |
108 | public void setProperties(Properties properties) {
109 | this.properties = properties;
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/src/main/java/org/springframework/data/elasticsearch/config/ElasticsearchNamespaceHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.springframework.data.elasticsearch.config;
18 |
19 | import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
20 | import org.springframework.data.elasticsearch.repository.config.ElasticsearchRepositoryConfigExtension;
21 | import org.springframework.data.repository.config.RepositoryBeanDefinitionParser;
22 | import org.springframework.data.repository.config.RepositoryConfigurationExtension;
23 |
24 | /**
25 | * ElasticsearchNamespaceHandler
26 | *
27 | * @author Rizwan Idrees
28 | * @author Mohsin Husen
29 | */
30 |
31 | public class ElasticsearchNamespaceHandler extends NamespaceHandlerSupport{
32 |
33 | @Override
34 | public void init() {
35 | RepositoryConfigurationExtension extension = new ElasticsearchRepositoryConfigExtension();
36 | RepositoryBeanDefinitionParser parser = new RepositoryBeanDefinitionParser(extension);
37 |
38 | registerBeanDefinitionParser("repositories", parser);
39 | registerBeanDefinitionParser("node-client", new NodeClientBeanDefinitionParser());
40 | registerBeanDefinitionParser("transport-client", new TransportClientBeanDefinitionParser());
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/org/springframework/data/elasticsearch/config/NodeClientBeanDefinitionParser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.springframework.data.elasticsearch.config;
18 |
19 | import org.springframework.beans.factory.support.AbstractBeanDefinition;
20 | import org.springframework.beans.factory.support.BeanDefinitionBuilder;
21 | import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
22 | import org.springframework.beans.factory.xml.ParserContext;
23 | import org.springframework.data.elasticsearch.client.NodeClientFactoryBean;
24 | import org.w3c.dom.Element;
25 |
26 | /**
27 | * NodeClientBeanDefinitionParser
28 | *
29 | * @author Rizwan Idrees
30 | * @author Mohsin Husen
31 | */
32 |
33 | public class NodeClientBeanDefinitionParser extends AbstractBeanDefinitionParser {
34 |
35 | @Override
36 | protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
37 | BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(NodeClientFactoryBean.class);
38 | setLocalSettings(element,builder);
39 | return getSourcedBeanDefinition(builder, element, parserContext);
40 | }
41 |
42 | private void setLocalSettings(Element element, BeanDefinitionBuilder builder) {
43 | builder.addPropertyValue("local", Boolean.valueOf(element.getAttribute("local")));
44 | }
45 |
46 |
47 | private AbstractBeanDefinition getSourcedBeanDefinition(BeanDefinitionBuilder builder, Element source,
48 | ParserContext context) {
49 | AbstractBeanDefinition definition = builder.getBeanDefinition();
50 | definition.setSource(context.extractSource(source));
51 | return definition;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/org/springframework/data/elasticsearch/config/TransportClientBeanDefinitionParser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.springframework.data.elasticsearch.config;
18 |
19 | import org.springframework.beans.factory.support.AbstractBeanDefinition;
20 | import org.springframework.beans.factory.support.BeanDefinitionBuilder;
21 | import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
22 | import org.springframework.beans.factory.xml.ParserContext;
23 | import org.springframework.data.elasticsearch.client.TransportClientFactoryBean;
24 | import org.w3c.dom.Element;
25 |
26 | import static org.apache.commons.lang.StringUtils.split;
27 | /**
28 | * TransportClientBeanDefinitionParser
29 | *
30 | * @author Rizwan Idrees
31 | * @author Mohsin Husen
32 | */
33 |
34 | public class TransportClientBeanDefinitionParser extends AbstractBeanDefinitionParser {
35 |
36 | private static final String SEPARATOR_CHARS = ",";
37 |
38 | @Override
39 | protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
40 | BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(TransportClientFactoryBean.class);
41 | setClusterNodes(element, builder);
42 | return getSourcedBeanDefinition(builder,element, parserContext);
43 | }
44 |
45 | private void setClusterNodes(Element element, BeanDefinitionBuilder builder){
46 | builder.addPropertyValue("clusterNodes", split(element.getAttribute("cluster-nodes"), SEPARATOR_CHARS));
47 | }
48 |
49 | private AbstractBeanDefinition getSourcedBeanDefinition(BeanDefinitionBuilder builder, Element source,
50 | ParserContext context) {
51 | AbstractBeanDefinition definition = builder.getBeanDefinition();
52 | definition.setSource(context.extractSource(source));
53 | return definition;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/org/springframework/data/elasticsearch/core/CriteriaQueryProcessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.data.elasticsearch.core;
17 |
18 | import org.elasticsearch.index.query.BoolQueryBuilder;
19 | import org.elasticsearch.index.query.BoostableQueryBuilder;
20 | import org.elasticsearch.index.query.QueryBuilder;
21 | import org.springframework.data.elasticsearch.core.query.Criteria;
22 | import org.springframework.util.Assert;
23 |
24 | import java.util.Iterator;
25 | import java.util.ListIterator;
26 |
27 | import static org.elasticsearch.index.query.QueryBuilders.*;
28 | import static org.springframework.data.elasticsearch.core.query.Criteria.OperationKey;
29 |
30 | /**
31 | * CriteriaQueryProcessor
32 | *
33 | * @author Rizwan Idrees
34 | * @author Mohsin Husen
35 | */
36 | class CriteriaQueryProcessor {
37 |
38 |
39 | QueryBuilder createQueryFromCriteria(Criteria criteria) {
40 | BoolQueryBuilder query = boolQuery();
41 |
42 | ListIterator chainIterator = criteria.getCriteriaChain().listIterator();
43 | while (chainIterator.hasNext()) {
44 | Criteria chainedCriteria = chainIterator.next();
45 | if(chainedCriteria.isOr()){
46 | query.should(createQueryFragmentForCriteria(chainedCriteria));
47 | }else if(chainedCriteria.isNegating()){
48 | query.mustNot(createQueryFragmentForCriteria(chainedCriteria));
49 | }else{
50 | query.must(createQueryFragmentForCriteria(chainedCriteria));
51 | }
52 | }
53 | return query;
54 | }
55 |
56 |
57 | private QueryBuilder createQueryFragmentForCriteria(Criteria chainedCriteria) {
58 | Iterator it = chainedCriteria.getCriteriaEntries().iterator();
59 | boolean singeEntryCriteria = (chainedCriteria.getCriteriaEntries().size() == 1);
60 |
61 | String fieldName = chainedCriteria.getField().getName();
62 | Assert.notNull(fieldName,"Unknown field");
63 | QueryBuilder query = null;
64 |
65 | if(singeEntryCriteria){
66 | Criteria.CriteriaEntry entry = it.next();
67 | query = processCriteriaEntry(entry.getKey(), entry.getValue(), fieldName);
68 | }else{
69 | query = boolQuery();
70 | while (it.hasNext()){
71 | Criteria.CriteriaEntry entry = it.next();
72 | ((BoolQueryBuilder)query).must(processCriteriaEntry(entry.getKey(), entry.getValue(), fieldName));
73 | }
74 | }
75 |
76 | addBoost(query, chainedCriteria.getBoost());
77 | return query;
78 | }
79 |
80 |
81 | private QueryBuilder processCriteriaEntry(OperationKey key, Object value, String fieldName) {
82 | if (value == null) {
83 | return null;
84 | }
85 | QueryBuilder query = null;
86 |
87 | switch (key){
88 | case EQUALS:
89 | query = fieldQuery(fieldName, value); break;
90 | case CONTAINS:
91 | query = fieldQuery(fieldName,"*" + value + "*").analyzeWildcard(true); break;
92 | case STARTS_WITH:
93 | query = fieldQuery(fieldName,value +"*").analyzeWildcard(true); break;
94 | case ENDS_WITH:
95 | query = fieldQuery(fieldName, "*"+value).analyzeWildcard(true); break;
96 | case EXPRESSION:
97 | query = queryString((String)value).field(fieldName); break;
98 | case BETWEEN:
99 | Object[] ranges = (Object[]) value;
100 | query = rangeQuery(fieldName).from(ranges[0]).to(ranges[1]); break;
101 | case FUZZY:
102 | query = fuzzyQuery(fieldName, (String) value); break;
103 | case IN:
104 | query = boolQuery();
105 | Iterable