Aller au contenu principal

CaaS and Geospatial-Index

Commentaires

3 commentaires

  • Zendesk API User
    Author: NMc - 3/7/2022 14:30
    In general an index in the Rest API can be created by following this documentation:

     

    You can read how a geospatial index would look like here: https://docs.mongodb.com/manual/geospatial-queries/#geospatial-indexes
     
    An example Request could look like this:
     
    curl --location --request PUT 'https://${customer}-${stage}caas-api.e-spirit.cloud/${tenant-id}/${project-uuid}.preview.content/_indexes/my-geospatial-index' \
    --header 'authorization: apikey="*****************"' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "keys": {
            "2dsphere": 1
        }
    }'
     

    Kind regards,

    Nico

    0
  • Zendesk API User
    Author: groth - 3/22/2022 16:44

    Hi  ,

    did the answer from  help? If not I might suggest a slightly different payload for the curl request:

    curl --location --request PUT 'https://${customer}-${stage}caas-api.e-spirit.cloud/${tenant-id}/${project-uuid}.preview.content/_indexes/my-geospatial-index' \ --header 'authorization: apikey="*****************"' \ --header 'Content-Type: application/json' \ --data-raw '{ "keys": { "<fieldname>": "2dsphere" } }'

    Based on these resources:

    Would love to get some feedback if your issue could be solved.

    Best regards, Chris

    0
  • Zendesk API User
    Author: MBischof - 3/23/2022 9:00

    HI , 

    thanks for your reply. Based on your suggestions we found a working solution for us.

    The basic things like the data-structure (Geo-Json Object) were correct before, the missing thing was to use a PUT-Statement to create the index over the correct field. Once this was done, getting the correct data with a $near-Operator was easy...

    So again thanks for you help and best regards,

    Marco

    0

Vous devez vous connecter pour laisser un commentaire.