Can I use nested facets in fts

can I use nested facets in fts?
like :
“facets”: {
“messageIds”: {
“size”: 5000,
“field”: “messageId”,
“facets”: {
“eventTypes”: {
“size”: 5000,
“field”: “eventType”,

                        }
                    }
                }
            }

I try but it not work :frowning:

How I can apply facets on full string(exact match) instate of words in string

@Dhaval ,

Can you elaborate a bit more on the exact nested faceting requirement with a sample doc for some clarity?

Now, words within a field value are showing up in the faceted results due to the analyzer used while indexing those fields.
You can use a keyword analyzer for those fields for preserving the original value as such and work around with that.
More details can be found in CB documentation - Understanding Analyzers | Couchbase Docs

Cheers!

Thank You for quick replay. Sorry for poor explanation. let me try to explain again.
Records I have :

sampleDoc1 Key : emailresponse|003602bf-9199-4753-a283-2b40136188ab
sampleDoc1 Value : {
“docId”: “003602bf-9199-4753-a283-2b40136188ab”,
“docType”: “emailresponse”,
“campaignId”: “ddd8896a-ed52-4f82-a452-7a60bf660f35”,
“destination”: “a@a.com”,
“eventType”: “Send”,
“messageId”: “dc229a90-cfcb-4973-b139-78644e733354”,
“segmentIds”: [
“707f2e5b-a4d4-47ef-9d63-f723238c2a33”,
“993ce76b-5fb9-4512-89b6-78bdd93b400e”
],
“created_at”: 1620110982136,
“updated_at”: 1620110982136
}

sampleDoc2 Key : emailresponse|00aa0126-613f-427a-bd9b-0c3d55a3ff27
sampleDoc2 Value : {
“docId”: “00aa0126-613f-427a-bd9b-0c3d55a3ff27”,
“docType”: “emailresponse”,
“campaignId”: “3b7e9713-13d0-4bc8-8846-87be677da734”,
“destination”: “b@b.com”,
“eventType”: “Send”,
“messageId”: “ad72b90b-065a-42e0-81e9-e8b8a8bbc1fb”,
“segmentIds”: [
“f641f59d-98e9-409e-9f4f-64d325bf9b4e”,
“993ce76b-5fb9-4512-89b6-78bdd93b400e”
],
“created_at”: 1620110988077,
“updated_at”: 1620110988077
}

my query :

{
“query”: {
“match”:“3b7e9713-13d0-4bc8-8846-87be677da734” ,
“field”: “campaignId”,
},
“score”: “none”,
“facets”: {
“messageIds”: {
“size”: 5000,
“field”: “messageId”,
“facets”: {
“eventTypes”: {
“size”: 5000,
“field”: “eventType”
}
}
}
}
}

my question :
I want facets in nested level. There are more then one doc which have same messageId. For particular message I have more then one entry for event like “open”, “click”, “forward”, etc…
so I want to get result in a way that will let me know that In particular campaignId I have X numbers of messages and each message have X number of events

Just check whether this suffice your requirement. (not sure whether I fully grok this)

  "query": {
    "match": "testID", "field":"campaignId"
  },
  	"facets": {
				"messageId": {
					"size": 5000,
					"field": "messageId"
				},
				"eventTypes": {
					"size": 5000,
					"field": "eventType"
				}
			}
}'

No it is not work for me. I already try this. it gives me a top level count of click and open. But not by messageId.
current result :

expected result :

@Dhaval This is happening because of the analyzer you’re using for the field.
If you want to generate facets on the full string - the exact match - then you’ll need to use the “keyword” analyzer for the field in your index definition, that’s eventType per your query.

@abhinav Thank You for replay. yes it word with keyword analyzer.

but still i am looking for nested facets. do you have any suggestion?