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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

unity3d - Fatal error- Monodevelop-Unity failed to start -