【发布时间】:2016-01-26 10:09:59
【问题描述】:
我在 PHP 中排序时遇到问题,这是我的映射:
{
"jdbc": {
"mappings": {
"jdbc": {
"properties": {
"admitted_date": {
"type": "date",
"format": "dateOptionalTime"
},
"et_tax": {
"type": "string"
},
"jt_tax": {
"type": "string"
},
"loc_cityname": {
"type": "string"
},
"location_countryname": {
"type": "string"
},
"location_primary": {
"type": "string"
},
"pd_firstName": {
"type": "string"
}
}
}
}
}
}
当我使用排序结果时,它会用字母数字对结果进行排序,它会先加载数字的结果。我只需要以字母开头的字母排序结果。现在它的顺序是这样的:
http://localhost:9200/jdbc/_search?pretty=true&sort=pd_lawFirmName:asc
- BM&A
- 戈麦斯-Acebo & Pombo
- 阿德尔肖戈达德
这样的结果如何排序?
- 阿德尔肖戈达德
- BM&A
- 戈麦斯-Acebo & Pombo
这是我用于索引的查询
{
"type" : "jdbc",
"jdbc" : {
"driver" : "com.mysql.jdbc.Driver",
"url" : "jdbc:mysql://localhost:3306/dbname",
"user" : "user",
"password" : "pass",
"sql" : "SQL QUERY",
"poll" : "24h",
"strategy" : "simple",
"scale" : 0,
"autocommit" : true,
"bulk_size" : 5000,
"max_bulk_requests" : 30,
"bulk_flush_interval" : "5s",
"fetchsize" : 100,
"max_rows" : 149669,
"max_retries" : 3,
"max_retries_wait" : "10s",
"locale" : "in",
"digesting" : true,
"mappings": {
"sorting": {
"properties": {
"pd_lawFirmName": {
"type": "string",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
}
}
【问题讨论】:
-
是的,但是它从最后一个单词中排序结果,这里是示例
pd_lawFirmName: "McDermott Will Amery",sort: ["amery"]。但第一个字母是M
标签: php sorting elasticsearch elasticsearch-jdbc-river