windows 10 pro office 2019 pro office 365 pro windows 10 home windows 10 enterprise office 2019 home and business office 2016 pro windows 10 education visio 2019 microsoft project 2019 microsoft project 2016 visio professional 2016 windows server 2012 windows server 2016 windows server 2019 Betriebssysteme office software windows server https://softhier.com/ instagram takipçi instagram beğeni instagram görüntüleme instagram otomatik beğeni facebook beğeni facebook sayfa beğenisi facebook takipçi twitter takipçi twitter beğeni twitter retweet youtube izlenme youtube abone instagram

I worked on query of Elastic Search. But my result was not sorted by A to Z. So, how can I sort my result by A to Z

Asked By: Anonymous

I worked on many fields in order to take my result that sorted by a to z. Here is the query that I wrote:

  query: {
    multi_match: {
      query: "m*",
      fields: ["name", "name_mn"],
      type: "phrase_prefix",
      max_expansions: 50,
      operator: "and",
      // fields: ['title', 'authors.*name'],

      //   minimum_should_match: 3,
      //   analyzer: "standard",

      //   slop: 3,
    },

Result

    1 - Mary to Majo no Hana (score: 5.140061)
    2 - Princess Mononoke (score: 4.0831547)
    3 - Girl Like Me (score: 3.5263605)
    4 - Love and Monsters (score: 3.5263605)
    5 - Howl's Moving Castle (score: 3.5263605)
    6 - Mairimashita! Iruma-kun S01 (score: 3.1031976)
    7 - Before We Get Married (score: 3.1031976)
    8 - Rick and Morty S01 (score: 3.1031976)
    9 - Majo no Tabitabi (score: 3.0155346)
    10 - In the mood for love (score: 2.770712)

What I actually wanted sort is like below:

    1 - Mary to Majo no Hana (score: 5.140061)
    2 - Mairimashita! Iruma-kun S01 (score: 3.1031976)
    3 - Majo no Tabitabi (score: 3.0155346)
    4 - Princess Mononoke (score: 4.0831547)
    5 - Girl Like Me (score: 3.5263605)
    6 - Love and Monsters (score: 3.5263605)
    7 - Howl's Moving Castle (score: 3.5263605)
    8 - Before We Get Married (score: 3.1031976)
    9 - Rick and Morty S01 (score: 3.1031976)
    10 - In the mood for love (score: 2.770712)

Solution

Answered By: Anonymous

If you want to sort the result in ascending order, based on the first letter of the sentence, then you need to sort the search results in ascending order

Adding a working example

Index Mapping:

{
  "mappings": {
    "properties": {
      "name": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword"
          }
        }
      }
    }
  }
}

Search Query:

{
  "query": {
    "multi_match": {
      "query": "m*",
      "type": "phrase_prefix"
    }
  },
  "sort": {
    "name.keyword": {
      "order": "desc"
    }
  }
}

Search Result:

"hits": [
      {
        "_index": "67651064",
        "_type": "_doc",
        "_id": "7",
        "_score": null,
        "_source": {
          "name": "Before We Get Married"
        },
        "sort": [
          "Before We Get Married"
        ]
      },
      {
        "_index": "67651064",
        "_type": "_doc",
        "_id": "3",
        "_score": null,
        "_source": {
          "name": "Girl Like Me"
        },
        "sort": [
          "Girl Like Me"
        ]
      },
      {
        "_index": "67651064",
        "_type": "_doc",
        "_id": "5",
        "_score": null,
        "_source": {
          "name": "Howl's Moving Castle"
        },
        "sort": [
          "Howl's Moving Castle"
        ]
      },
      {
        "_index": "67651064",
        "_type": "_doc",
        "_id": "10",
        "_score": null,
        "_source": {
          "name": "In the mood for love"
        },
        "sort": [
          "In the mood for love"
        ]
      },
      {
        "_index": "67651064",
        "_type": "_doc",
        "_id": "4",
        "_score": null,
        "_source": {
          "name": "Love and Monsters"
        },
        "sort": [
          "Love and Monsters"
        ]
      },
      {
        "_index": "67651064",
        "_type": "_doc",
        "_id": "6",
        "_score": null,
        "_source": {
          "name": "Mairimashita! Iruma-kun S01"
        },
        "sort": [
          "Mairimashita! Iruma-kun S01"
        ]
      },
      {
        "_index": "67651064",
        "_type": "_doc",
        "_id": "9",
        "_score": null,
        "_source": {
          "name": "Majo no Tabitabi"
        },
        "sort": [
          "Majo no Tabitabi"
        ]
      },
      {
        "_index": "67651064",
        "_type": "_doc",
        "_id": "1",
        "_score": null,
        "_source": {
          "name": "Mary to Majo no Hana"
        },
        "sort": [
          "Mary to Majo no Hana"
        ]
      },
      {
        "_index": "67651064",
        "_type": "_doc",
        "_id": "2",
        "_score": null,
        "_source": {
          "name": "Princess Mononoke"
        },
        "sort": [
          "Princess Mononoke"
        ]
      },
      {
        "_index": "67651064",
        "_type": "_doc",
        "_id": "8",
        "_score": null,
        "_source": {
          "name": "Rick and Morty S01"
        },
        "sort": [
          "Rick and Morty S01"
        ]
      }
    ]

techinplanet staff


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno