如何将弹性查询转换为NEST?

时间:2017-11-21 12:52:26

标签: elasticsearch nest

我是弹性搜索新手。我有这个弹性查询,我想转换成NEST。

.element::-webkit-scrollbar {
    -webkit-appearance: none;
}

到目前为止,我已经尝试过了。

GET _search
{
 "from": 0,
 "size": 0,
 "aggs": {
   "stock": {
     "terms":{
       "order" : {
         "_term" : "asc" 
       },
       "script" : {
         "inline": "Math.sin(17*(double)doc['dealerId'].value) + '_' + doc['dealerId'].value",
         "lang": "painless"
       },
       "size":5
     },
     "aggs": {
       "sample":{
         "top_hits": {
             "sort": [
             {
               "_script": {
                  "type": "number",
                  "script": {
                     "lang": "painless",
                     "inline": "Math.sin(34*(double)doc['sortScore'].value)"
                  },
                  "order": "asc"
               }
             }
           ],
           "size" : 1
         }
         }
     }
   }
 }
}

client.Search<StockBaseEntity>(ss => ss .From(0) .Size(0) .Aggregations(agg => agg .Terms("stock", t => t .Script(script => script .Inline("Math.sin(5*(double)doc['dealerId'].value)+'_'+doc['dealerId'].value") .Lang("painless")) .OrderAscending("_term") .Size(5) .Aggregations(ag => ag .TopHits("sample", t11 => t11.Sort(st => st --------->Now I don't know How can I achieve next part as ".Script" is not present )))))); 不包含TopHitsAggregationDescriptor,因为我无法以我想要的方式对文档进行排序。弹性查询工作完全正常,那么如何将其转换为嵌套?任何建议都会有所帮助。

由于

0 个答案:

没有答案