2016-11-08 2 views
0

Все. Я использую ElasticSearch 5.0 и у меня есть следующее отображение:Я не могу получить вложенные stored_fields

{ 
    "mappings": { 
     "object":{ 
      "properties":{ 
       "attributes":{ 
        "type":"nested", 
        "properties":{ 
         "name": { "type": "keyword", "store":true}, 
         "value": { "type": "text", "store":true }, 
         "converted": {"type": "double", "store":true}, 
         "datetimestamp": { "type": "date", "store":true} 
        } 
       } 
      } 
     } 
    } 
} 

Затем я добавить один документ:

{ 
    "attributes":[ 
     {"name":"attribute_string", "value":"string_value","converted":null,"datetimestamp":null}, 
     {"name":"attribute_double", "value":"1234.567","converted":1234.567,"datetimestamp":null}, 
     {"name":"attribute_datetime", "value":"2015-01-01T12:10:30Z","converted":null,"datetimestamp":"2015-01-01T12:10:30Z"} 
     ]  
} 

Когда я запрашиваю ж/«stored_fields», у меня нет полей в результатах :

_search 
{ 
    "stored_fields":["attributes.converted"] 
} 

Результаты:

{ 
    "_index": "test_index", 
    "_type": "object", 
    "_id": "1", 
    "_score": 1 
} 

Но когда я использую "_source": [ "attributes.converted"], у меня есть результат:

{ 
    "_index": "test_index", 
    "_type": "object", 
    "_id": "1", 
    "_score": 1, 
    "_source": { 
     "attributes": [ 
      { "converted": null }, 
      { "converted": 1234.567 }, 
      { "converted": null  } 
     ] 
    } 
} 

Что такое правильный способ использовать stored_fields? Использует ли использование «_source» производительность при сравнении с методом «stored_fields»?

Если «_source» подходит быстро как «stored_fields», я должен удалить «store»: true для полей?

спасибо.

ответ

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