ArcGIS Rest API returnDistinctValues with multiple output fields

965
2
06-23-2022 05:59 AM
TimLeefmann
New Contributor II

We are running ArcGIS Enterprise 10.9 and have created a SBDS using the Geoevent Server. When trying to query the layers of the associated Feature Services for distinct records using multiple output fields, we get the following error message (see screenshot in addition):

"Return distinct values query is not supported for multiple fields on Elasticsearch, returnGeometry must be false."

However, the documentation of the ArcGIS REST API on Query (Feature Service/Layer) states:

returnDistinctValues

If true, it returns distinct values based on the fields specified in outFields. This parameter applies only if the supportsAdvancedQueries property of the layer is true. This parameter can be used with returnCountOnly to return the count of distinct values of subfields.

 

The returnGeoemetry  option was set to "false", and the supportsAdvancedQueries of the FeatureService/layer is "true". From this I would assume that it should be possible to return Distinct Combinations of fields from the feature Service. Am I something missing here, or is this a mistake in the documentation?

 

 

Bildschirmfoto vom 2022-06-23 14-42-34.png

2 Replies
OsamaOthman
Esri Contributor

Hi @TimLeefmann ,

This may not be the solution, but have you tried to set ReturnCountOnly to True and see if the query returns the same error or not? Maybe you can also consider using only one field in the outfields and check the functionality first. If the query gives the result, then you can try adding more fields.

Please keep me updated.

TimLeefmann
New Contributor II

Hi @OsamaOthman,

Yes I already tried that (ReturnCountOnly=True + Multiple Output Fields) and it works. But this is not what I wanted, as I need the actual distinct combinations of field values and not just the count of distinct combinations. If you set ReturnCountOnly=False + Multiple Output Fields the query will throw you the respective error. The same is true for trying to use GroupBy with multiple fields.