1
votes

I have an entity class with only indexName in annotation.

@Document(indexName = "person")
public class Person {
...
}

I have documents in Person index with different types user,employee with same fields.

I wanted to pass index type at run time using esTemplate. something like below; setType("employee")

Is it possible to set the index type in spring data elastic search query?

Thanks,

1
Can you add little more words to explain the problem statement. Did you try something. Any tried sample code would help others to understand the problem. - Suvasis

1 Answers

0
votes

We need to use query.addTypes(typeName). It works fine for me.