2016-09-21 2 views
0

Как я могу сделать elasticsearch возврата вложенных значений в формате хиты {value1:..., value2..., value3..., etc..}Elasticsearch - возврат вложенных значений в формате

This is my request: 
{ 
    "_source": 0, 
    "query": { 
    "bool": { 
     "must": [ 
     { 
      "nested": { 
      "path": "photo", 
      "query": { 
       "bool": { 
       "must": [ 
        { 
        "match": { 
         "photo.hello": "true" 
        } 
        } 
       ] 
       } 
      }, 
      "inner_hits" : {} 
      } 
     } 
     ] 
}}} 

{ "took": 4, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 2, "max_score": 1.2231436, "hits": [ { "_index": ".3eautiful", "_type": "profile", "_id": "6UAaCls5iSgavEtFE2qMX902Xmb2", "_score": 1.2231436, "inner_hits": { "photo": { "hits": { "total": 1, "max_score": 1.2231436, "hits": [ { "_index": ".3eautiful", "_type": "profile", "_id": "6UAaCls5iSgavEtFE2qMX902Xmb2", "_nested": { "field": "photo", "offset": 0 }, "_score": 1.2231436, "_source": { "hello": "true", "i_am_superCOOL": "true", "xoxox": "true", "id": "-KSDRx5BN54JHitoq7Wb" } } ] } } } }, { "_index": ".3eautiful", "_type": "profile", "_id": "KDFbeXrOedf7b6NVRGMO0HDIFgx1", "_score": 1.2231436, "inner_hits": { "photo": { "hits": { "total": 2, "max_score": 1.2231436, "hits": [ { "_index": ".3eautiful", "_type": "profile", "_id": "KDFbeXrOedf7b6NVRGMO0HDIFgx1", "_nested": { "field": "photo", "offset": 1 }, "_score": 1.2231436, "_source": { "alahu": "true", "hello": "true", "same": "true", "smukais": "true", "id": "-KSDJzyUC_N5je-cR2aT" } }, { "_index": ".3eautiful", "_type": "profile", "_id": "KDFbeXrOedf7b6NVRGMO0HDIFgx1", "_nested": { "field": "photo", "offset": 0 }, "_score": 1.2231436, "_source": { "hello": "true", "same": "true", "selfyyy": "true", "superSexy": "true", "id": "-KPn4p7spS8NO7IVSLdF" } } ] } } } } ] } }

Я использую 2 размерного поиск динамического атрибута, проблема с этим подходом является что результат может быть 20 от 1 пользователя, но мне нужно сделать его обоснованным.

ответ

0

Просто придерживается того же формата.

Смежные вопросы