首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用elasticsearch对包含geo_point和日语字符的4个条件进行排序

用elasticsearch对包含geo_point和日语字符的4个条件进行排序
EN

Stack Overflow用户
提问于 2018-10-09 15:22:31
回答 1查看 87关注 0票数 0

我有一些商店的文件,如下所示。如何才能查询到:

  1. number_fans在商店的降序
  2. number_articles在商店的降序
  3. 关闭当前仓位顺序
  4. 日语字母顺序

索引数据

代码语言:javascript
复制
curl -XPUT "localhost:9200/shops/doc/1" -H 'Content-Type: application/json' -d'  
{
 "id": 1,
 "name": "中村 裕美子",
 "furigana_name": "木村 稔",
 "number_fans": 4,
 "number_articles": 1,
 "group_name": "有限会社 伊藤",
 "location": {
     "lat": 35.1284,
     "lon": 137.1446
     }
 }

curl -XPUT "localhost:9200/shops/doc/2" -H 'Content-Type: application/json' -d'  
{
 "id": 2,
 "name": "山田 明美",
 "furigana_name": "木村 稔",
 "number_fans": 3,
 "number_articles": 2,
 "group_name": "有限会社 佐藤",
 "location": {
     "lat": 35.1177,
     "lon": 137.1915
     }
 }

curl -XPUT "localhost:9200/shops/doc/3" -H 'Content-Type: application/json' -d'  
{
 "id": 3,
 "name": "松本 晃",
 "furigana_name": "松本 裕美子",
 "number_fans": 3,
 "number_articles": 3,
 "group_name": "株式会社 青山",
 "location": {
     "lat": 35.1098,
     "lon": 137.4242
     }
 }

这是我的查询,但它缺少过滤器,日语字母表字符的顺序和不确定是正确的顺序为其他。

代码语言:javascript
复制
curl -XPOST "localhost:9200/shops/_search" -H 'Content-Type: application/json' -d'  
{
"query": {
    "match_all" : {}
},
"sort": [
    { "number_fans": { "order": "desc" } },
    { "number_articles": { "order": "desc" } },
    { "_geo_distance" : {
            "location": {
                "lat": 35.13914,
                "lon": 137.18779
            },
            "order" : "desc",
            "unit" : "km"
        }
    }
],
"size": 200
}

提前感谢!

EN

回答 1

Stack Overflow用户

发布于 2018-10-10 02:24:51

对于#4,您需要按照furigana_name列进行排序,该列应该有日语字母Hiragana或Katakana。

您的示例数据似乎不正确,因为furigana_name有另一个人的kanji名称。例如,第一张唱片的名字“中村裕美子”应该有furigana_name“なかむらゆみこ”(我猜发音可能是错的)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52724454

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档