I am developing the Spring Boot + MongoDB + spring data mongo + Text search Example. By taking a reference from link: https://spring.io/blog/2014/07/17/text-search-
first drop indexs commandline db.order-details.dropIndex()
and refactor this line TextCriteria criteria = TextCriteria.forDefaultLanguage().matchingPhrase("OrderID").matchingPhrase(String.valueOf(orderId)); after run application