Can we have custom fields index to be included in the Highlights of search?


(Hanumanth B) #1

I need '_type' field to be included in the response Highlights of search call, currently it has DocumentId and Highlights fields. This I can take from Hits but I want it from Highlights.
Below is my query

{
  "from": 0,
  "size": 40,
  "_source": {
	"include": [],
	"exclude": [
	  "*"
	]
  },
  "sort": [
	{
	  "MAINTITLE.untouched": {
		"order": "desc"
	  }
	},
	{
	  "series_name.untouched": {
		"order": "desc"
	  }
	}
  ],
  "query": {
	"filtered": {
	  "query": {
		"bool": {
		  "must": [
			{
			  "query_string": {
				"query": "pft",
				"fields": [
				  "MAINTITLE.ngramanalyzed",
				  "S_TG_KEYWORDS.ngramanalyzed",
				  "series_name.ngramanalyzed",
				  "teamNameA.ngramanalyzed",
				  "teamNameB.ngramanalyzed"
				],
				"default_operator": "and"
			  }
			}
		  ]
		}
	  },
	  "filter": {
		"bool": {
		  "must": [],
		  "must_not": [],
		  "should": [
			{
			  "bool": {
				"should": [
				  {},
				  {
					"terms": {
					  "channel.untouched": [
						"DEMO-CHANNEL4",
						"DEMO-CHANNEL3",
						"DEMO-CHANNEL2",
						"DEMO-CHANNEL1",
						"NA"
					  ]
					}
				  }
				]
			  }
			}
		  ]
		}
	  }
	}
  },
  "highlight": {
	"pre_tags": [
	  ""
	],
	"post_tags": [
	  ""
	],
	"fields": {
	  "MAINTITLE.ngramanalyzed": {},
	  "S_TG_KEYWORDS.ngramanalyzed": {},
	  "series_name.ngramanalyzed": {},
	  "teamNameA.ngramanalyzed": {},
	  "teamNameB.ngramanalyzed": {}
	}
  }
}

In response I am getting DocumentId, Field as "MAINTITLE.ngramanalyzed", and Highlight.
To this I need to include "_type" field also. Can anyone please help me to achieve this?


(system) #2