Is there a way to remove old data from azure search index

1.6k views Asked by At

I have created a search service on azure. Now there is some data change on the db and some values are removed. When i reset and run the indexer after completion the search explorer is still showing old values which are not required. For example:this the response before change for cycle:202007

        "ID":"ABC_202007",
        "EntityID": "ABC",
        "PartnerOneName": "ABC",
        "RiskScore": 47.04,
        "POCount": 2,
        "POAmount": 591925.54,
        "Category": "ABC",
        "Cycle": "202007",
        "Country": "ABC",
        "Area": "ABC",
        "POAmountScore": 100,
        "POCountScore": 96,

now, after some time the cycle is changed to 202019 and when i reset and run the indexer the response is :

{
            "ID":"ABC_202007"
            "EntityID": "ABC",
            "PartnerOneName": "ABC",
            "RiskScore": 47.04,
            "POCount": 2,
            "POAmount": 591925.54,
            "Category": "ABC",
            "Cycle": "202007",
            "Country": "ABC",
            "Area": "ABC",
            "POAmountScore": 100,
            "POCountScore": 96,
},

{
              "ID":"ABC_202019"
            "EntityID": "ABC",
            "PartnerOneName": "ABC",
            "RiskScore": 47.04,
            "POCount": 2,
            "POAmount": 591925.54,
            "Category": "ABC",
            "Cycle": "202019",
            "Country": "ABC",
            "Area": "ABC",
            "POAmountScore": 100,
            "POCountScore": 96
}

I want only the second result set. Please help.

1

There are 1 answers

0
oliver_t On

Unfortunately, you can only delete single documents by id, which is described here. Iterating over mutliple documents and deleting them one by one is currently the only way. Thanks Microsoft!

Deleting mutliple documents is a long wanted feature, but nothing happened so far. Please vote for the suggestion, if you also consider this to be essential.

In your case it would make sense to make EntityID as id, so the documents get overwritten. Or you just create queries that filter out the outdated versions... who cares about storage space.