Need to get matched fields from document on querying

Hi All,

I need to get only matched fields from returned document on search.

Here is my sample index:
{
"_index": "company",
"_type": "data",
"_id": "1",
"_version": 1,
"found": true,
"_source": {
"cpn": "companycpn",
"cpn_desc": "_NA",
"mpn": "2-020 TFE_Tri",
"commodity_name": "_NA",
"sub_commodity_name": "HARDWARE & MISC",
"manufacturer_name": "PARKER HANNIFIN",
"supplier_name": "ABCDE",
"product_name": "NA",
"product_description": "NA",
"product_family_name": "NA",
"cm_odm_name": "CRF",
"fiscal_year": "2015",
"fiscal_quarter": "1"
}
}

Here is the GET query which I am using:
GET company/data/_search
{
"query": {

"query_string": {
  "query": "*parker*"
}

},
"size": 10
}

If you observe for the above query the matched field 'manufacturer_name' in _source. I need to get only this field, i.e I want to get only matched fields for the given query from elasticsearch.

Is there any way for this ?

Thanks,
Srinivas

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