Creating Indexname Dynamically using Spring-Data Elasticsearch with @Document -
i trying indexname
dynamically in
@document(indexname="something",type="type")
i have tried using below code:
@document(indexname="#{systemproperties['databasename'] }", type = "dbtype")
but @ runtime when sending 2 request ui data es different indexes,it not working properly.
what should solve issue?
a workaround is, work nativesearchquerries. there can set index whatever like:
nativesearchquery query = new nativesearchquerybuilder().withindices(indexname) .withquery(querybuilders.matchphrasequery("_all", request.getsearchterm().getsearchstring())) .withpageable(new pagerequest(request.getpaging(), request.getmaxresults())) .... .build(); result =elastic.query(query, query->query2result(query));
Comments
Post a Comment