Index in key and value form

How can I get result like this..."search_data": [
....
"string_facet": [
{
"facet-name": "manufacturer",
"facet-value": "Fortis"
},
{
"facet-name": "hammer_weight",
"facet-value": "1000"
}
],
"number_facet": [
{
"facet-name": "final_gross_price",
"facet-value": 822
}
]
},

means..result after index coming in key and value form .....but my result like this..
"title": "Asus MemoPad ME172V-1A076A 17c",
"features": "",
"fs_description": "",
"price": 3994,
"last_update": "2017-11-03T05:30:58.000Z",
"fsid": "",
"@version": "1",
"id": 10000000844,
"brand": "ASUS",
"fs_updated": 0,

I change in setting and use the nested type...but still result like above...any idea...

Thanks in advance.

I have not fully understood what you are after here.

First, it seems you are searching not for individual hits in your search response, but rather for aggregations. So first thing you should take a look at are aggregations.

If this is not the case, please take some more time to explain what you are after. What you cannot do is to modify the JSON response during your search. When a search hit is returned it always contains the original JSON.

Hi spinscale!
Thanks for answer. Actually I want to store my data in key and value form like this
jsondata": """
{
"facet_name": "size",
"facet_value": "S"
},
{
"facet_name": "color",
"facet_value": "black"
},
{
"facet_name": "fabric",
"facet_value": "cotton"
}
But I am using mysql and there is every field comes under _source like this...
....
"product_name": "sildenafil citrate",
"supplier": "Wisozk Inc",
"quantity": 261,
"unit_cost": "$10.47"
....
I tried also nested but result not get....
can you just me some idea....

Thank you.

ah, got it. So this is not an Elasticsearch issue, but a pure ingestion issue. You need to fix your tooling, which indexes into Elasticsearch to properly prepare the JSON.

Hi Spinscale....I am using logstash.....Have you any idea...about this...

Thanks in advance.

just move over to logstash and ask your question there, just provide all your configuration to make it easier for others to answer your questions.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.