ndevroy
1/25/2019 - 6:46 PM

GET Requests for CWAAS

Sample search requests using index mappings for CWAAS

#Get all records in the index
GET /cwaas_api_spec/_doc/_search
{
  "query" : { 
    "match_all" : {  }
  }
}

#===============================================================================

#Get records using term query - fields that are not nested are fair game
GET /cwaas_api_spec/_doc/_search
{
  "query": { 
        "multi_match" : {
            "query" : "123456",
            "fields" : "masterIndividualIdentifier"
        }
  }
}

#===============================================================================

#Parameter query involving nested fields
GET /cwaas_api_spec/_doc/_search
{
  "query": 
  {
    "bool": {
      "must": [
          {
            "match": {
                       "masterIdentifiers.keyChainIdentifiers.allSaversAlternateMemberIds.value":"9001000"
            }
          }
        ]
    }
  }
}

#===============================================================================

#Nested multiple queries
GET /cwaas_api_spec/_doc/_search
{  
   "query":{  
      "bool":{  
         "must":[  
            {  
               "exists":{  
                  "field":"masterIdentifiers.keyChainIdentifiers"
               }
            },
            {  
               "match":{  
                  "masterIdentifiers.keyChainIdentifiers.allSaversAlternateMemberIds.value":"9001000"
               }
            }
         ]
      }
   }
}