I am trying a elastic search example after inserting 6 records into my elastic search DB.
The records inserted are simple json with two properties Id and text
"OCC-001","Car Damaged During Loading"
"OCC-002","Car jango jango jango Damaged Loading"
"OCC-003","hjjkhjkasd hjkhjklhas d Cars asdasd jango asdsas jango jango Damaged asdsad asdasdasd Loading"
"OCC-004","This should not come at all "
"OCC-005","This may come Car"
"OCC-006","Will this come Cars"
I am doing a search like below
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(
matchQuery("title","Car Damaged"))
.build();
FacetedPage<Occurrence> occurrences = myElasticSearchRepository.search(searchQuery);
return occurrences;
I am getting the incorrect results and in wrong order
"OCC-005","This may come Car"
"OCC-001","Car Damaged During Loading"
"OCC-002","Car jango jango jango Damaged Loading"
When i do the same search using the below query I get right results but in different order
http://localhost:9200/myIndex/cars/_search?q=Car%20Damaged
"OCC-001","Car Damaged During Loading"
"OCC-002","Car jango jango jango Damaged Loading"
"OCC-005","This may come Car"
"OCC-003","hjjkhjkasd hjkhjklhas d Cars asdasd jango asdsas jango jango Damaged asdsad asdasdasd Loading"
Looks like I am dong something fundamentally incorrect.
Kindly advise.