facebook

test test

//Only for development purpose
[HttpGet(]
public async Task<IActionResult>ReIndex()
{
 await _elasticClient.DeleteByQueryAsync<Product>(q => q.MatchAll());
 
 var allProducts = (await _productService.GetProducts(int.MaxValue)).ToArray();
 
 foreach (var product in allProducts)
  {
 await _elasticClient.IndexDocumentAsync(product);
  }
 
 return Ok($"{allProducts.Length} product(s) reindexed");
}

For development purposes, we have implemented the ReIndex method, which allows us to delete all the documents on the index and import them again one by one. It can be useful for importing lists of existing and not loaded documents.

For development purposes, we have implemented the ReIndex method, which allows us to delete all the documents on the index and import them again one by one. It can be useful for importing lists of existing and not loaded documents.