Hi Team,
I am working for an application. This application does CRUD operations to elasticsearch along with search queries.
I am using spring data elasticsearch repositories/elasticsearchTemplate for CRUD operations.
and I am using native elasticsearch api for search queries.
for Eg:
client.prepareSearch(Constants.GENSUITE_PART_FACET_INDEX)
.setTypes(Constants.ITEM_FACET_MAP_TYPE).setQuery(QueryBuilders.boolQuery()
.must(QueryBuilders.termsQuery("partId", partIdList))
.must(QueryBuilders.matchQuery("partTypeId", partTypeId))
.must(QueryBuilders.matchQuery("facetId", facetId)))
.addAggregation(AggregationBuilders.terms("group_by_facetData").field("facetData.keyword").order(Terms.Order.count(false)).size(0))
.setFrom(0).setSize(0).execute().actionGet();
The above search query uses java elasticsearch api but not spring data elasticsearch.
is this the right way to use both spring data elasticsearch(CRUD) and java elasticsearch api(search) in a single application.
if I have to use only spring data elasticsearch alone, is there any way that I can use the methods instead of @query annotation.
Please let me know I am in the right direction, or should I do any modification.
Thanks,
Lakshmi.