MP API queries using boolean search

According to the docs, we can use the following for materials involving only silicon and oxygen:

from mp_api.client import MPRester

with MPRester("your_api_key_here") as mpr:
    docs = mpr.summary.search(chemsys="Si-O", 
                              fields=["material_id", "band_gap"])
    mpid_bgap_dict = {doc.material_id: doc.band_gap for doc in docs}

Similarly we can use elements = ['Si', 'O'] instead of chemsys for materials involving at least silicon and oxygen.

Can we use boolean search? i.e. what do we do for searching materials involving silicon or oxygen?

Hi @R_Walser,

Similarly we can use elements = ['Si', 'O'] instead of chemsys for materials involving at least silicon and oxygen.

Yes, definitely.

Can we use boolean search? i.e. what do we do for searching materials involving silicon or oxygen?

Unfortunately, no. In that case, you will have to make two separate queries and use the exclude_elements parameter.

– Jason