I am trying to search an email in Sitecore Xdb using the code :

var queryable = client.Contacts
                               .Where(c => c.GetFacet<EmailAddressList>(EmailAddressList.DefaultFacetKey).PreferredEmail.SmtpAddress == emailid)
                               .WithExpandOptions(new ContactExpandOptions(EmailAddressList.DefaultFacetKey));

var enumerator = queryable.GetBatchEnumeratorSync(10);

But I am getting getting


I have already done this :



Rebuild the xdb search index

I am working on XConnect Scaled Environment.

Kindly help!


Hi thanks for the suggestions, I changed my search query to a custom facet :

queryable = client.Contacts.Where(c => c.GetFacet<EqContactFacet>(EqContactFacet.DefaultFacetKey).EmailId == emailid) .WithExpandOptions(new ContactExpandOptions(EqContactFacet.DefaultFacetKey));

But I am facing this error while executing the above query :

Error in Submit ==> Sitecore.XConnect.XdbSearchUnavailableException: The HTTP response was not successful: InternalServerError at Sitecore.Xdb.Common.Web.Synchronous.SynchronousExtensions.SuspendContextLock[TResult](Func 1 taskFactory) at Sitecore.XConnect.Client.XConnectSynchronousExtensions.SuspendContextLock[TResult](Func1 taskFactory) at Sitecore.XConnect.Client.XConnectSynchronousExtensions.GetBatchEnumeratorSync[TEntity](IAsyncQueryable1 asyncQueryable, Int32 defaultBatchSize) at EloquaSitecoreConnector.Personalization.MergeContacts.MergeSitecoreContacts(String emailid)

Also I have done the steps you provided, and rebuild the xdb_index as well.

Please help as this is working fine in my dev environment but not in the scaled xconnect environment.

  • Please make an effort to understand what this site is about. It is not a support forum.
    – Mark Cassidy
    Apr 5 '20 at 12:42

You query looks fine, but be sure that you did following steps:

  • Enable IndexPIISensitiveData for xConnect in xconnect.instance\App_Data\Config\Sitecore\SearchIndexer\sc.Xdb.Collection.IndexerSettings.xml

  • Enable IndexPIISensitiveData for IndexWorker in xconnect.instance\App_Data\jobs\continuous\IndexWorker\App_data\config\sitecore\SearchIndexer\sc.Xdb.Collection.IndexerSettings.xml

  • Restart xConnect in IIS

  • Restart IndexWorker in Windows services:

  • Request xdb index rebuilding xconnect.instance\App_Data\jobs\continuous\IndexWorker>XConnectSearchIndexer.exe -rr

Next navigate to Solr and open your xdb_index schema. You should see that field facets.emails.preferredemail.smtpaddress_s is appeared and indexed:

enter image description here

If you see data in Solr - you query will work fine and return coresponding results.


If you want to be complaint with GDPR it makes sense to store/duplicate PII sensitive data that you need to access by search queries in separate facet without [PIISensitive] attribute and dont use IndexPIISensitiveData, just to prevent indexing the rest of PII sensitive data.

  • please answer the below query @x3mxray Apr 4 '20 at 22:49
  • I have done these steps but still I am getting the count zero. I have also checked in the solr that the smtp address is indexed. @x3mxray May 4 '20 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.