Search code examples
elasticsearchresponse

How can filter or exclude error fields in ElasticSearch?


It is possible reduce error response in case of exception?

  • my index -> aho_bas
  • my call via curl -> curl -v "localhost:9200/aaho_bas/_search?filter_path=took" (I intentionallity typed wrong the url)

  • response I'm getting: {"error":"error_cause":[{"type":"index_not_found_exception",etc...}]}

I'm trying get only some fields, like error.reason. I need can manipulate the error response structure. It is possible? Thank you


Solution

  • The error is because really no index exists in elastic. Looking closely at your index and query

    index name -> aho_bas index name from your query-> aaho_bas

    query: curl -v "localhost:9200/aaho_bas/_search?filter_path=took

    Since no index exists with that name, which is responsible for the origin of the error.