I need to use dynamic index per request in spring data elastic search. I got it working by creating a @RequestScope object
how does singleton bean handle dynamic index
I am trying to get it working without creating @RequestScope object. I set the attributes in request. But I don't know to read it out in SpEL
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
httpRequest.setAttribute("indexName", "indexA");
@Document(indexName = "#${request.getAttribute('indexName')}", createIndex = false) --not working
public class MyDocument{
I also try @Document(indexName = "#${@request.getAttribute('indexName')}", createIndex = false)