Regexp support in source filtering

Hi All,
I have a question about the capabilities of source filtering.
I have documents which represents products. Each document contains a set product properties and a set of product prices, one price for each country. Something like:

"product": {
	"name": "ProductA",
	"description": "Product A is really cool",
	"collection": "cool products",
	"prices": {
			"price": 3000,
			"formattedPrice": "3,000 $"
			"price": 2900,
			"formattedPrice": "2.900 €"
			"price": 2850,
			"formattedPrice": "2.850 €"
			"price": 3050,
			"formattedPrice": "CHF 3,050"

I would like to use source filtering to return all the document fields, except for prices. For Prices I would like to return only the price of a specific country I know at query time.
For instance: if I'm searching in the context of Switzerland I would need something like:

"_source": {
	"includes": "<all fields>"
	"excludes": "<all prices that are not for Switzerland>"

I tried with "excludes": "prices.~CH", which doesn't work.
The only solution I could find was to add in the excludes clause all the prices that I don't want. e.g.

"_source": {
	"includes": "*"
	"excludes": ["prices.US", "prices.DE", "prices.FR", ..."]

The problem is that the list of countries for which I have a price is long, and can be different from product to product.

Is there a better way to address this requirement?

Thanks in advance,

Hi Francisco,

the only operator source filtering supports is the wildcard-operator to match full field names.
So "prices." or ".DE" etc. would match all subfields inside the prices object or all objects that contain a "DE" field inside a document.

More advanced operators are unfortunatley not supported as far as I know.

Kind regards,

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