В Elastic Search 5.1 Я делаю базовый запрос с аргументом body_alls (новое имя для аргумента старых полей) для получения значения определенного поля.эластичный поиск 5.1 почему stored_fields не возвращает поле запроса?
Но мой запрос не дают никакого значения поля в ответ, кроме _index, _Type, _id и _SCORE
Даю вам образец для контекста:
создать индекс и отображение с:
PUT /base_well
{
"mappings": {
"person": {
"properties": {
"first_name":{
"type": "string"
},
"last_name":{
"type": "string"
},
"age":{
"type": "long"
}
}
}
}
}
Я заполняю:
POST /base_well/person
{
"first_name":"James",
"last_name" : "Mopo",
"Age" : 21
}
POST /base_well/person
{
"first_name":"Polo",
"last_name" : "Rodriguez",
"Age" : 36
}
POST /base_well/person
{
"first_name":"Marc Aurelien",
"last_name" : "Poisson",
"Age" : 26
}
POST /base_well/person
{
"first_name":"Mustapha",
"last_name" : "Bulutu M'Bo",
"Age" : 47
}
Я делаю свою заявку с:
POST /base_well/person/_search
{
"stored_fields": ["first_name"]
}
И это дает мне answere без запрашиваемого поля fiest_person:
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 8,
"max_score": 1,
"hits": [
{
"_index": "base_well",
"_type": "person",
"_id": "AVlFYzihcR_Z5VPUXUCL",
"_score": 1
},
{
"_index": "base_well",
"_type": "person",
"_id": "AVlFiv3acR_Z5VPUXUCa",
"_score": 1
},
{
"_index": "base_well",
"_type": "person",
"_id": "AVlFiwUKcR_Z5VPUXUCb",
"_score": 1
},
{
"_index": "base_well",
"_type": "person",
"_id": "AVlFYx2LcR_Z5VPUXUCI",
"_score": 1
},
{
"_index": "base_well",
"_type": "person",
"_id": "AVlFYyhScR_Z5VPUXUCJ",
"_score": 1
},
{
"_index": "base_well",
"_type": "person",
"_id": "AVlFYzIJcR_Z5VPUXUCK",
"_score": 1
},
{
"_index": "base_well",
"_type": "person",
"_id": "AVlFivgzcR_Z5VPUXUCZ",
"_score": 1
},
{
"_index": "base_well",
"_type": "person",
"_id": "AVlFiw2qcR_Z5VPUXUCc",
"_score": 1
}
]
}
}
Кто-нибудь может объяснить мне, чтобы сделать это и как это работает, пожалуйста?
Вы видите источник, если добавить в запрос запрос '' _source ': true'? – Val
нет, может быть, это answere –
Я озадачен тем, что вы упоминаете 'stored_fields' в своем вопросе, но я не вижу этого в вашем запросе. – Val