In Elastic Search 5.1, I make a basic request with the body_alls argument (the new name for the old fields argument) to get the value of a specific field.
But my request does not give the field value in the response, except for _index, _type, _id and _score
I give you a sample for context:
I am creating an index and mapping using:
PUT /base_well { "mappings": { "person": { "properties": { "first_name":{ "type": "string" }, "last_name":{ "type": "string" }, "age":{ "type": "long" } } } } }
I fill in:
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 }
I make my request with:
POST /base_well/person/_search { "stored_fields": ["first_name"] }
And he gives me the answer without the requested fiest_person field:
{ "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 } ] } }
Can someone explain to me how to do this and how it works?