I have two users in my db collection and those names are john and john-son , now I am trying to select all records which are matching with my search text among all fields of db collection. For example my search text is john then my query is by using elasticsearch java api
QueryBuilder queryBuilderForUserSearch = QueryBuilders.must(
QueryBuilders.fieldQuery("_all", "*" + q + "*"));
It's working fine. But when I am trying to search with special character text like john-son by this time it returns zero records. Can anybody please help me why it's happens and please provide the query for select text with special characters also.