I am new to AWS elasticsearch but need to create queries to search the follow data with different criteria.
- search_metadata (json string with key/value pair) -
"{\"number\":\"111\"; \"area\":\"central\"; "\code\":\"1111\"; \"type\":\"internal\"}"
- category -
"statement" or "bill" or "email"
- datetime -
"2019-05-04T00:00:00" or "2019-07-16T00:01:00"
- flag -
"good" or "bad"
I need to construct query to do the following
- AND or OR condition in search_metadata field (JSON string) -> not sure how to do it.
along with AND condition for category, datetime range and flag. -> Do I need to use muliti-match for flag and category ?
"query": { "bool": { "must": [ { "match_phrase": { "search_metadata": "number 111" --> not sure about AND or OR with "area" and others } }, { "range": { "datetime": { "gte": "2019-05-04T00:00:00Z", "lte": "2019-07-16T00:01:00Z" } } } ] } } }