FTS JSON facets

I’ve JSON document organized as (for example…):

“subscriptions”: [
“subscription”: “XXXXXX ZZZZZZZ RRRRRR”
“subscription”: “BBBBBBB AAAAAAA”

I need to prepare JSON with ‘facets’ for FTS that returns back the single phrase inside the field specified as facet (for example…):

subscriptions: “XXXXXX ZZZZZZZ RRRRRR” (count)
subscriptions: “BBBBBBB AAAAAAA” (count)

ecc. ecc.

My JSON request is (for example…):

		"explain": true,
		"fields": [ "field1,field2,subscriptions"],
		"highlight": {},
		"query": {"disjuncts":
				{ "conjuncts": [ { "query": "My Name" } ] }
		"size": 10,
		"from": 0,
		"facets": {
			"subscriptions": {
				"size": 1000,
				"field": "subscriptions.subscription"

Thanks in advace for your help.

In order to do that, you need to index the subscriptions.subscription field with the ‘keyword’ analyzer. That will keep the text ‘xxxxxx zzzzzz rrrrrr’ text intact as a single term for the facet results. NOTE: the ‘keyword’ analyzer is most likely not what you want to use if you want to also search on the subscription field. If you need to search the field and create facets as you described, then you need to index that field multiple times. The second time use the ‘searchable as’ field in the UI to give it a different name (something like subscription_facet)