W Elastic Search 5.1 Wykonuję podstawowe żądanie z argumentem treści stored_fields (nowa nazwa dla argumentu old fields) w celu pobrania wartości określonego pola.wyszukiwanie elastyczne 5.1 dlaczego pola_pakietowe nie zwracają pola pytania?
Ale moja prośba nie dają wartość pola w odpowiedzi wyjątkiem _index, _Typ, _id i _score
dam ci próbki dla kontekstu:
utworzyć indeks i mapowanie z:
PUT /base_well
{
"mappings": {
"person": {
"properties": {
"first_name":{
"type": "string"
},
"last_name":{
"type": "string"
},
"age":{
"type": "long"
}
}
}
}
}
Zapełniam:
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
}
Na życzenie wykonuję:
POST /base_well/person/_search
{
"stored_fields": ["first_name"]
}
I to daje mi answere bez wnioskowanej fiest_person polu:
{
"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
}
]
}
}
ktoś mógłby wyjaśnić mi to zrobić i jak to działa proszę?
Czy widzisz źródło, jeśli dodasz '" _source ": true' do zapytania? – Val
Nie, może to jest odpowiedź –
Jestem zdziwiony, ponieważ w pytaniu wspomniałeś 'stored_fields', ale nie widzę tego w twoim zapytaniu. – Val