Skip to content
  • About Us
  • Contact Us
  • Privacy Policy
  • Disclaimer
  • Corona Virus Stats (Covid-19)
  • Work with us
  • FB
  • LinkedIn
  • Twitter
  • Instagram.com
Tekraze

Tekraze

Dive Into Technology

  • Guides
    • Developer Guide
    • PC Guide
    • Web Guide
    • Android Guide
    • Music
    • Tutorials
  • Feed
    • Tech News
    • Shared Tech
    • Gaming Videos
    • Unboxing videos
  • Forums
    • Android Apps
    • Angular Npm Packages
    • Useful Site Links
    • Tech Queries
    • Windows OS Help
    • Web Guide and Help
    • Android Os And Rooting
    • Jhipster Discussion
    • Git & GitHub forum
    • Open Source Forum
  • Work with us
  • Toggle search form
Match Score With Spring data elastic search in Spring Boot for a Query Banner

Get Match Score With Spring data elastic search in Spring Boot for a Query

Posted on December 20, 2020January 16, 2021 By Balvinder Singh No Comments on Get Match Score With Spring data elastic search in Spring Boot for a Query

Get Match Score With Spring data elastic search in Spring Boot for a Query

Hi everyone, I am gonna share the scoring and percentage from the es query to order results and show them to the user.

Previously, I was using an elastic search rest-client template to have a search query, but that way I have to do extract score, and list of data with mapping to the required format. The configuration is a little more and complex than using spring data elasticsearch directly. But after looking for a solution to fix some other issue I have, I got the solution for getting a score directly from spring data elasticsearch with a little modification.

Also Read | Add Amazon Comprehend to Spring Boot App

Let me share.

I have done with pagination, but you can do normally too by using stream with a list instead. let me know if you want in the comments below, I will add.

Steps to get Match Score Elasticsearch

  1. We create a normal Query like match query
  2. call the bookpage method with a query and pageable parameters
  3. Create a search query with required options
  4. Call the elastic search template query method to modify and extract the response. it is the main point where you get the hit score and total hits.
  5. call additional bookDOFromMap method to get a score and append to DTO.

6. Now you have the score calculated from hit score of each record vs all records.

You can modify the query or scoring logic; by using a function score query with a scoring function for your needs.


I hope it will help, you.

Also, do check out other blog for more tech posts like this.

Also Read | Add AWS Transcribe to Spring Boot APP
Content Protection by DMCA.com
Developer Guide, Tutorials Tags:Elastic Query, elasticsearch, Match Score, spring boot, Spring data, Spring data elastic

Post navigation

Previous Post: How to add 3D option in Adobe Photoshop CS6?
Next Post: Using apt tool infographics Linux basic tool series part 1

Related Posts

  • Content Security Policy JHipster Tekraze
    Content Security Policy Jhipster (Spring Boot) JHipster
  • ADD AWS Transcribe to Spring Boot APP Tekraze
    Add AWS Transcribe to Spring boot App Developer Guide

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Advertisements

Subscribe to updates

Enter your email below to subscribe





Posts by Categories

Advertisements
  • Simple Tips to Troubleshoot Computer Issues
    Learn 7 Simple Tips to Troubleshoot Computer Issues PC Guide
  • Customizing Apps that are not on play store 1
    Customizing Apps that are not on play store Android Guide
  • Why Join A Company that's scaling Up | Tekraze 2
    Why Join A Company that’s scaling Up | Tekraze Tech News
  • Class 12 Syllabus 2022-23 UP Board Exam Banner
    Class 12 Syllabus 2022-23 UP Board Exam detailed Education
  • Common Docker Commands you must know Tekraze
    Common Docker Commands you must know Developer Guide
  • The Latest Android Update Is Focused on Security
    The Latest Android Update Is Focused on Security Android Guide
  • How To install Eclipse IDE - Video 3
    How To install Eclipse IDE – Video Tutorials
  • How to Install PHP XAMPP 4
    How to Install PHP XAMPP PHP Tutorials

Affliate Links

Sell with Payhip

Earn with Magenet

Sell and Buy with Adsy

GainRock affiliate Program

Automatic Backlinks

Advertise with Anonymous Ads

Crypto Blogs

  • Blurt
  • Hive
  • Serey
  • Nostr

accessily tekraze verificationIndian Blog Directory

Copyright © 2023 Tekraze.

Powered by PressBook News WordPress theme