:doc:`MailManager <../../mailmanager>` / Client / start_archive_search

********************
start_archive_search
********************



.. py:method:: MailManager.Client.start_archive_search(**kwargs)

  

  Initiates a search across emails in the specified archive.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/mailmanager-2023-10-17/StartArchiveSearch>`_  


  **Request Syntax**
  ::

    response = client.start_archive_search(
        ArchiveId='string',
        Filters={
            'Include': [
                {
                    'StringExpression': {
                        'Evaluate': {
                            'Attribute': 'TO'|'FROM'|'CC'|'SUBJECT'|'ENVELOPE_TO'|'ENVELOPE_FROM'
                        },
                        'Operator': 'CONTAINS',
                        'Values': [
                            'string',
                        ]
                    },
                    'BooleanExpression': {
                        'Evaluate': {
                            'Attribute': 'HAS_ATTACHMENTS'
                        },
                        'Operator': 'IS_TRUE'|'IS_FALSE'
                    }
                },
            ],
            'Unless': [
                {
                    'StringExpression': {
                        'Evaluate': {
                            'Attribute': 'TO'|'FROM'|'CC'|'SUBJECT'|'ENVELOPE_TO'|'ENVELOPE_FROM'
                        },
                        'Operator': 'CONTAINS',
                        'Values': [
                            'string',
                        ]
                    },
                    'BooleanExpression': {
                        'Evaluate': {
                            'Attribute': 'HAS_ATTACHMENTS'
                        },
                        'Operator': 'IS_TRUE'|'IS_FALSE'
                    }
                },
            ]
        },
        FromTimestamp=datetime(2015, 1, 1),
        ToTimestamp=datetime(2015, 1, 1),
        MaxResults=123
    )
    
  :type ArchiveId: string
  :param ArchiveId: **[REQUIRED]** 

    The identifier of the archive to search emails in.

    

  
  :type Filters: dict
  :param Filters: 

    Criteria to filter which emails are included in the search results.

    

  
    - **Include** *(list) --* 

      The filter conditions for emails to include.

      

    
      - *(dict) --* 

        A filter condition used to include or exclude emails when exporting from or searching an archive.

        .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``StringExpression``, ``BooleanExpression``. 

      
        - **StringExpression** *(dict) --* 

          A string expression to evaluate against email attributes.

          

        
          - **Evaluate** *(dict) --* **[REQUIRED]** 

            The attribute of the email to evaluate.

            .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``Attribute``. 

          
            - **Attribute** *(string) --* 

              The name of the email attribute to evaluate.

              

            
          
          - **Operator** *(string) --* **[REQUIRED]** 

            The operator to use when evaluating the string values.

            

          
          - **Values** *(list) --* **[REQUIRED]** 

            The list of string values to evaluate the email attribute against.

            

          
            - *(string) --* 

            
        
        
        - **BooleanExpression** *(dict) --* 

          A boolean expression to evaluate against email attributes.

          

        
          - **Evaluate** *(dict) --* **[REQUIRED]** 

            The email attribute value to evaluate.

            .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``Attribute``. 

          
            - **Attribute** *(string) --* 

              The name of the email attribute to evaluate.

              

            
          
          - **Operator** *(string) --* **[REQUIRED]** 

            The boolean operator to use for evaluation.

            

          
        
      
  
    - **Unless** *(list) --* 

      The filter conditions for emails to exclude.

      

    
      - *(dict) --* 

        A filter condition used to include or exclude emails when exporting from or searching an archive.

        .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``StringExpression``, ``BooleanExpression``. 

      
        - **StringExpression** *(dict) --* 

          A string expression to evaluate against email attributes.

          

        
          - **Evaluate** *(dict) --* **[REQUIRED]** 

            The attribute of the email to evaluate.

            .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``Attribute``. 

          
            - **Attribute** *(string) --* 

              The name of the email attribute to evaluate.

              

            
          
          - **Operator** *(string) --* **[REQUIRED]** 

            The operator to use when evaluating the string values.

            

          
          - **Values** *(list) --* **[REQUIRED]** 

            The list of string values to evaluate the email attribute against.

            

          
            - *(string) --* 

            
        
        
        - **BooleanExpression** *(dict) --* 

          A boolean expression to evaluate against email attributes.

          

        
          - **Evaluate** *(dict) --* **[REQUIRED]** 

            The email attribute value to evaluate.

            .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``Attribute``. 

          
            - **Attribute** *(string) --* 

              The name of the email attribute to evaluate.

              

            
          
          - **Operator** *(string) --* **[REQUIRED]** 

            The boolean operator to use for evaluation.

            

          
        
      
  
  
  :type FromTimestamp: datetime
  :param FromTimestamp: **[REQUIRED]** 

    The start timestamp of the range to search emails from.

    

  
  :type ToTimestamp: datetime
  :param ToTimestamp: **[REQUIRED]** 

    The end timestamp of the range to search emails from.

    

  
  :type MaxResults: integer
  :param MaxResults: **[REQUIRED]** 

    The maximum number of search results to return.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'SearchId': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 

      The response from initiating an archive search.

      
      

      - **SearchId** *(string) --* 

        The unique identifier for the initiated search job.

        
  
  **Exceptions**
  
  *   :py:class:`MailManager.Client.exceptions.ValidationException`

  
  *   :py:class:`MailManager.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`MailManager.Client.exceptions.ServiceQuotaExceededException`

  
  *   :py:class:`MailManager.Client.exceptions.ConflictException`

  
  *   :py:class:`MailManager.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`MailManager.Client.exceptions.ThrottlingException`

  