Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Connectors API] Fix bug when creating a sync job via API #104802

Merged
merged 3 commits into from
Jan 26, 2024

Conversation

jedrazb
Copy link
Member

@jedrazb jedrazb commented Jan 26, 2024

Changes

  • Fix Connector representation in ConnectorSyncJob class, the filtering field should only represent the active rules applied for a given sync job, otherwise it will cause a sync job to fail
  • This should be backported to 8.12 as a bugfix
  • Adapt tests
  • Tested manually

Reproduction

  • Create a connector
  • Get its ID
  • Trigger a on demand sync job via API , I could reproduce getting an error
[FMWK][15:49:32][ERROR] [Connector id: HUeGQI0BpfSJQu5aFEpG, index name: search-gdrive, Sync job id: KkcYQY0BpfSJQu5a9krZ] dictionary update sequence element #0 has length 3; 2 is required
Traceback (most recent call last):
  File "/Users/jedr/connectors-python/connectors/sync_job_runner.py", line 139, in execute
    await self._execute_content_sync_job(job_type, bulk_options)
  File "/Users/jedr/connectors-python/connectors/sync_job_runner.py", line 195, in _execute_content_sync_job
    await self.sync_job.validate_filtering(validator=self.data_provider)
  File "/Users/jedr/connectors-python/connectors/protocol/connectors.py", line 290, in validate_filtering
    validation_result = await validator.validate_filtering(self.filtering)
  File "/Users/jedr/connectors-python/connectors/protocol/connectors.py", line 252, in filtering
    return Filter(self.get("connector", "filtering", default={}))
  File "/Users/jedr/connectors-python/connectors/protocol/connectors.py", line 413, in __init__
    super().__init__(filter_)
ValueError: dictionary update sequence element #0 has length 3; 2 is required

@elasticsearchmachine
Copy link
Collaborator

Hi @jedrazb, I've created a changelog YAML for you.

@jedrazb jedrazb marked this pull request as ready for review January 26, 2024 12:41
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/ent-search-eng (Team:Enterprise Search)

@jedrazb jedrazb changed the title [Connectors API] Fix bug when triggering a sync job via API [Connectors API] Fix bug when creating a sync job via API Jan 26, 2024
@jedrazb jedrazb requested a review from timgrein January 26, 2024 12:54
Copy link
Contributor

@timgrein timgrein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@jedrazb jedrazb merged commit a107107 into elastic:main Jan 26, 2024
15 checks passed
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.12 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 104802

@jedrazb
Copy link
Member Author

jedrazb commented Jan 26, 2024

💚 All backports created successfully

Status Branch Result
8.12

Questions ?

Please refer to the Backport tool documentation

jedrazb added a commit to jedrazb/elasticsearch that referenced this pull request Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants