1
検索エンジンとしてelasticsearchを使用したいと思います。私はelasticsearchに対するMySQLからレコードをコピーしていると私はelasticsearchを照会するとき、私は、弾性のデータと値を計算し、その結果elasticsearchで計算された値でソートする方法
を並べ替えるためにそれを使用したい私のインデックスは次のようになります。
{
"busquedas" : {
"aliases" : { },
"mappings" : {
"coche" : {
"properties" : {
"coeff_e" : {
"type" : "double"
},
"coeff_r" : {
"type" : "double"
},
"desc" : {
"type" : "string"
}
}
}
},
"settings" : {
"index" : {
"creation_date" : "1460116924258",
"number_of_shards" : "5",
"number_of_replicas" : "1",
"uuid" : "N6jhy_ilQmSb6og16suZ4g",
"version" : {
"created" : "2030199"
}
}
},
"warmers" : { }
}
}
と私は
myCustomOrder = (coeff_e + coeff_r) * timestamp
のようにレコードごとに値を計算し、その結果
0123をソートするためにそれを使用したいです{
"sort" : [
{ "myCustomOrder" : {"order" : "asc"}},
"_score"
],
"query" : {
"term" : { ... }
}
}
私は値を計算するためにグルーヴィーに使用することができます知っているが、そのは
{
"from": 10,
"size": 3,
"filter": {
"script": {
"script": "doc['coeff_e'].value < 0.5"
}
}
}
例に示したように、私は唯一のフィルタリングするためにそれを使用することができますが、私は完全にelasticsearchする初心者です、よろしくお願いします:D
これをチェック>> http://stackoverflow.com/questions/36019873/elastic-search-aggregation-with-range-query – Arun