sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Issue importing SharePoint search schema

Open roberAlb opened this issue 2 years ago • 21 comments

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

SharePoint CSOM

Developer environment

Windows

What browser(s) / client(s) have you tested

  • [ ] 💥 Internet Explorer
  • [ ] 💥 Microsoft Edge
  • [ ] 💥 Google Chrome
  • [ ] 💥 FireFox
  • [ ] 💥 Safari
  • [ ] mobile (iOS/iPadOS)
  • [ ] mobile (Android)
  • [X] not applicable
  • [ ] other (enter in the "Additional environment details" area below)

Additional environment details

No response

Describe the bug / error

We were importing the search schema without any issue for months. Last 2 weeks ago, we got an error trying to use the same search schema without any change applied. The error was "Bad request: Please export a new search configuration firstly and then use it to import if you are improting a stale exported search configuration file". Even using the UI was failing, not just with the code. It happened just in one tenant, but now happening in 3-4 tenants.

Steps to reproduce

  1. Import and old search schema

Expected behavior

We were expecting the search schema to be imported without issue.

roberAlb avatar Apr 04 '22 14:04 roberAlb

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ghost avatar Apr 04 '22 14:04 ghost

I have more information, finally we managed to import the search schema, we exported from the tenant and we made some amends into our search schema that we are provisioning with code. After that, the error "Bad request: Please export a new search configuration firstly and then use it to import if you are improting a stale exported search configuration file" disappeared but a new one was coming "Microsoft.SharePoint.Client.ServerException : Bad request while trying to reach endpoint POST Call to Setting Type Bulk, Please try again, SSMS request".

After reviewing it, looks like it's something about the result sources, if we put the same id of the result source from the tenant in the xml, no error is coming but this is not good, as we were deploying the search schema in a lot of clients and the result sources ids were created without taking into account what is in the XML. I guess, that the easy option is to remove the result sources from the tenant and provision them again, but I'm not even allowed to remove the result source from there, the page is refreshed without removing it and getting 302 status error from the Network.

roberAlb avatar Apr 06 '22 11:04 roberAlb

My client is encountering this issue, too. This code has been running fine for years.

Here is the CSOM:

Microsoft.SharePoint.Client.SearchExtensions.SetSearchConfigurationImplementation(ClientRuntimeContext context, SearchObjectLevel searchObjectLevel, String searchConfiguration)

brett-src avatar Apr 07 '22 17:04 brett-src

Hello, I have encountered this issue as well on multiple tenants. Same error from CSOM as above.

Radu-Andrei-Ionut avatar Apr 11 '22 08:04 Radu-Andrei-Ionut

FYI: Strange behaviour on our side as well :-(.

We have an issue with Result Sources (started on Tuesday last week). The settings that has been exported months ago does not work anymore. Newly exported search settings from on site cannot be imported to another if there are Results sources defined already (update between environments, error message "Source with nam already exists").

However, the import works for fresh sites or after we removed existing Result Sources (it was required to remove existing Result Sources before first import only)

salascz avatar Apr 11 '22 10:04 salascz

@VesaJuvonen can provide an update and ETA on a fix? Thanks.

brett-src avatar Apr 12 '22 17:04 brett-src

For us is happening in a fresh tenant as well, the problem is with the result sources, if we remove them from the schema imported, it works. We managed to import it with the result sources if the result source id is the same from result source deployed in the tenant, but this was not required in the past, even if you deployed a result source with an id, it was provisioned with a different one.

roberAlb avatar Apr 25 '22 13:04 roberAlb

@wobba are you aware about this issue about the provisioning of search schema? we have raised a ticket with Microsoft support but there is no luck in providing a fix or providing the steps to remediate it.

roberAlb avatar Apr 26 '22 06:04 roberAlb

I think I've run into a similar issue now. My use case would be to update 50 result sources with a breaking change in the search query syntax.

Exporting the config to XML from tenant A works. Doing changes to result sources within the XML and reimporting to tenant A doesn't update anything nor does give any error.

Importing the config to tenant B works. And I am also able to do additional changes within that search config XML and reimport to tenant B successfully.

I've managed to track down the issue down to the resultsource Id. If I'm creating the result source by importing from another tenants search configuration XML everything works - as long as I use the same ResultSource Id I used when first importing search config. Even though the generated resultsource Id is different from the one in the imported configuration xml.

So technically I'm able to update result sources programmatically within a tenant if I create the configuration first on tenant A, and then keep importing that configuration XML to tenant B while doing changes on the XML.

Works (step 1)

  1. Create a result source in tenant A
  2. Export search config to an XML file
  3. Import the search config to tenant B
  4. Make changes to the XML file (e.g. change result source description)
  5. Import the search config to tenant B with the changes (no issues detected)
  6. Changes work

Doesn't work (step 2)

  1. After doing things mentioned above
  2. Export search config from tenant B to an XML file
  3. Make changes to the tenant B search config XML file (e.g. change result source description)
  4. Import the tenant B search config to tenant B with the changes (no issues detected)
  5. No changes can be seen in tenant B

After doing step 2 without the configuration working, I can still continue working on the XML created in step 1 and reimport it successfully to tenant B.

I've tried both working via Search Admin UI and PnP PowerShell.

jhholm avatar Apr 28 '22 16:04 jhholm

Currently having the same issue with importing an XML search configurations. I have tried this both manually and utilising PnP PowerShell I get the same issue regardless with the error message appearing as:

Set-PnPSearchConfiguration: Bad request: Please export a new search configuration firstly and then use it to import if you are improting a stale exported search configuration file

I have tried exporting search schemas from two different tenants and importing these in to seperate tenants and the same issue occurs. When I utilise PnP PowerShell as follows:

Set-PnPSearchConfiguration -Path ".\SearchConfiguration.xml" -Scope Site

Additionally if I try to import a PnP XML site template I get the same error in the console when the search configuration is imported.

I am trying to create an automated process within Azure Functions whereby a new site is created and the search is configured, any ideas on a work around for this would be great.

adam13hylo avatar May 10 '22 10:05 adam13hylo

@adam13hylo I suggest you log this as a support ticket with Microsoft, and when repro'ing the issue use the import/export UX in SharePoint and not the PnP cmdlet's. Anything API/PowerShell takes longer to get thru.

wobba avatar May 11 '22 14:05 wobba

Getting this now as well. This is a pretty new site collection, and the first time I'm making Search schema changes, just in case it helps.

I'm seeing it when running some dodgy PowerShell I found somewhere on the internet, on this guy's site: https://github.com/wobba/SearchConfiguration (just kidding, thanks @wobba for the very useful script!)

HiltonGiesenow avatar May 11 '22 16:05 HiltonGiesenow

Hello everyone, I seem to be getting the same issue in a relatively fresh tenant. No result sources to import, just property mappings and failing every time.

attCurtisHennessy avatar May 12 '22 08:05 attCurtisHennessy

Same issue here on all of our tenants.

MudassarAli avatar May 18 '22 13:05 MudassarAli

Same issues on our side. We have problems on 2 out of 3 tenants. Some problems started around March/April but we managed to workaround them (it was about change in default value for Result Types processing parameter and the issue with Query Rules conditions - specifically condition to fire on give result source that is no longer working).

This week huge problems with importing/exporting search configuration started on those 2 same tenants. Basically things that have been working for years without problems suddenly stopped. Exporting search configuration with CSOM (on fresh site with one single result source created manually in GUI) do not work since this week - and the same was fine for years. We get meaningless 'something went wrong' without any details while trying to access Query Rules view in Site Settings.

Interestingly all those issues thankfully not reached our third tenant (we have situation in which tenants 'differ 3 months' in terms of some 'search flavors' and damaged functionalities).

dev-a11y avatar Jun 09 '22 17:06 dev-a11y

@dev-a11y it would help if you could open a support ticket for each affected tenant.

wobba avatar Jun 10 '22 07:06 wobba

We have the same issue, sinds the last few months we are unable to import our search schema (hasn't changed sinds december last year) for all our customers. Even when exporting the customers own seach schema, it fails to import it without any modifications.

Seems to be a global issue, maybe SP search is updated in an incompatible way?

ronaldvanhelden avatar Jun 15 '22 14:06 ronaldvanhelden

@ronaldvanhelden you should log a support ticket.

wobba avatar Jun 20 '22 16:06 wobba

Any updates?

rodasasamoila avatar Jul 19 '22 08:07 rodasasamoila

@rodasasamoila please log a support ticket with Microsoft for this issue.

wobba avatar Jul 19 '22 09:07 wobba

In my case, I have seen some issue related to searchconfiguration.xml file.

Exported searchconfiguration.xml from "A" tenant.

Before importing the searchconfiguration.xml to "B" tenant. I made changes to the values in the SchemaId for two xml tags mentioned below. The below two xml tags will be repeated multiple times and should have same value consistent through out the entire "searchconfiguration.xml" file.

Tag1: d3p1:SchemaId 0 </d3p1:SchemaId> Tag2: d5p1:SchemaId 0 </d5p1:SchemaId>

The value may not be 0 always but it should have any value that should be consistent in the entire file.

This one resolved the issue for me : "Bad request: Please export a new search configuration firstly and then use it to import if you are importing a stale exported search configuration file".

srivathsan18 avatar Aug 18 '22 10:08 srivathsan18

We are getting an internal server error now when trying to import a search configuration into the tenant. This seems to happen on all tenants and there is no difference if you are doing it via UI or code...

OliverZeiser avatar Sep 02 '22 06:09 OliverZeiser

Same issue here on 3 different tenants, even when exporting an existing search configuration and re-importing it on the same tenant we get an internal server error.

nicolaor avatar Sep 05 '22 13:09 nicolaor

We managed to fix the error "Bad request: Please export a new search configuration firstly and then use it to import if you are improting a stale exported search configuration file" changing the schema, now getting Internal Server Error without any clarifications.

roberAlb avatar Sep 05 '22 14:09 roberAlb

This workaround does not work. You can export the search config from a brand new tenant and import it into the same tenant again and it will fail. @wobba can you have a look at this and let us know here if you can confirm this issue and if there is work beeing done to get this resolved?

OliverZeiser avatar Sep 06 '22 05:09 OliverZeiser

@wobba are there any plans to issue a fix? What does logging a support ticket accomplish?

brett-src avatar Sep 06 '22 19:09 brett-src

We have opened tickets with Microsoft from different tenants to elevate the issue urgency, if you are opening tickets as well, please share your ids if you can to pack them to show Microsoft that this is affecting everyone.

roberAlb avatar Sep 07 '22 06:09 roberAlb

I have created a ticket with microsoft [Case #:32656650] still work in progress on their side

ronaldvanhelden avatar Sep 07 '22 15:09 ronaldvanhelden

I have news about this, we can import now the schema without issues, new result sources are imported fine, existing result sources are updated fine, but if we delete an existing result source and we try to deploy it again using the schema, they are deployed but we are getting Sorry, something went wrong from the UI when we try to access to it

roberAlb avatar Sep 09 '22 09:09 roberAlb

Should be fixed as of 9/12.

wobba avatar Sep 15 '22 18:09 wobba