Hi, I am using Elastic Search URL to get metadata from ESRI Geoportal.
When I am Posting query in Geoportal it is returning single feature set as result and it's total count in DB( Feature set Count Exceeds Default Count :10000).
For Ex:- PayLoad Screenshot below.
Response Screenshot Below:
But For every Distinct Value against a Field in Metadata i am posting individual query with changed field value.
So to reduce the number of posted queries.
Is there any way we can get all the distinct values against a tag and their respective counts in metadata using elastic search if any please reply.
.
Not sure exactly what you're trying to achieve, but with the elastic proxy API endpoint in Geoportal Server you can use aggregation queries following elastic's syntax. Below is an example:
{"aggregations": {"keywords_s_count": {"terms": {"field": "keywords_s","size": 10}}}}
POST this query to the elastic proxy api endpoint with your from and size values:
geoportal/elastic/metadata/item/_search?from=0&size=10
will result in something like below
..."aggregations": {"keywords_s_count": {"doc_count_error_upper_bound": 0,"sum_other_doc_count": 0,"buckets": [{ key": "EARTH SCIENCE", "doc_count": 8},{"key": "RIVERS/STREAMS", "doc_count": 4},{"key": "SURFACE WATER","doc_count": 2},{"key": "SURFACE WATER FEATURES","doc_count": 1}]}}}
Hi Marten,
Thank you so much for your response on above asked question. we are expecting the same result which you have shared above.
and as suggested by you,
1. we have tried to replicate aggregation query as mentioned below :
I am also attaching json sample as a reference if you to have a look.
2. Is there any problem with terms aggregation if field type is not keyword and is in form _txt in place of _s.
please note that the field you are trying to get aggregation information for is called: src_Spatial_representation_type_txt, not src_Spatial_representation_type_txt_s