'Elasticsearch request validation

I'm trying to figure out if I can validate elasticsearch requests against a pre-defined mapping. I've googled around and searched StackOverflow, but haven't been able to find anything that speaks to what I'm trying to do apart from this question from a year ago that went unanswered.

Is there any tool out there that fits this need, or that at the least would convert ES mappings to some other easily validatable entity like JSONSchema? Extra points if that tool would be accessible in Python, but any language would work.


Specifics:

I'm looking at the openFDA API, which has, e.g., this endpoint for animal and veterinary data. openFDA provides this mapping (YAML download here) for valid fields. I'd like to be able to e.g. make sure that a provided animal.age field is an object instead of some other type, since such a query not obeying the defined mapping returns a rather unhelpful message stating that no records were found.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source