The query is returning the proper results given the single document approach that was taken on the openFDA, which is to say that your query is technically asking show me all of the documents that have both patient.drug.medicinalproduct:"Fish Oil"
and at least one entry in patient.drug
where drugcharacterization:1
. It is not taking into account that they are on the same patient.drug
record.
This is the result of a design decision of the mapping for adverse events. An alternative approach would have been to design the mapping as a parent/child
or a nested
document, in which case your query would behave the way that you expected. We chose the approach that we did for simplicity and stability reasons. We also were not sure how much this query pattern that you are speaking of would emerge. Please feel free to submit a feature request on the following file: https://github.com/FDA/openfda/blob/master/schemas/faers_mapping.json#L68, so that it is a nested mapping.
In the mean time, you can finish the filtering on the client-side by reading all of the search results and doing an additional filter in your code. There are some caps in place to protect the system, so you will have to break your query into reasonable chunks, years or months added to your criteria should do the trick.
Thanks for using openFDA, hope this helps.