Need to extract the records as per below requirement

     --------------------------------------------------------------------- 
 Requirement is as below. please have a look:                  
                                 
                                    I want result to be in such a way that the records matches both the skills should come first then any record having at least one skill should come next and the rest later(no match) .If there are 'n' skills in the given query , i should get the record with 'n' skills matching (if exists) then (n-1) and so on till 0 skill match
    
 below is my index mapping
                     
                        {
                              "skills": {
                                "type": "nested",
                                "dynamic": "true",
                                "properties": {
                                  "id": {
                                    "type": "long"
                                  },
                                  "isHighlight": {
                                    "type": "boolean"
                                  },
                                  "skill": {
                                    "type": "text",
                                    "fields": {
                                      "keyword": {
                                        "type": "keyword",
                                        "ignore_above": 32766,
                                        "normalizer": "lowerasciinormalizer"
                                      }
                                    }
                                  },
                                  "yearsOfExp": {
                                    "type": "float"
                                  }
                                }
                              }
                            }
                    below is my index data
                        ***//myindexdata***
                        {
                              "_index": "tenant1_candidate",
                              "_type": "docs",
                              "_id": "953",
                              "_score": 0.0074906712,
                              "_source": {
                                "record": {
                                  "skills": [
                                    {
                                      "id": 0,
                                      "skill": "Jr.Software Developer",
                                      "yearsOfExp": 2,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "AJAX",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "Angular Developer",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "AngularJS",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "Apache Subversion",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "API",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "Bachelors Degree",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "Back End",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "Bootstrap",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "Cascading Style Sheets",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "CRUD",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "CSS3",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "Design Patterns",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "Excellent analytical and logical programming skills",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "Front End",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "Git",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "HTML",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "HTML5",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "JavaScript",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "jQuery",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "Jr. UI Developer",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "JSON",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "Microsoft Access",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "Microsoft SQL Server",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "Microsoft Visual Studio",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "MySQL",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    },
                                    {
                                      "id": 0,
                                      "skill": "RESTful",
                                      "yearsOfExp": 1,
                                      "isHighlight": false
                                    }
                                    
                                  ]
                                },
                                "entityType": "Candidate",
                                "index": "tenant1_candidate",
                                "dbId": "953",
                                "id": "953"
                              }
                            }

Welcome to our community! :smiley:

Can you please edit your post and remove the formatting, it's very hard to read the non-code text.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.