Skip to content

Improve Analyzer definitions and fix various classes #3215

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

Merged
merged 13 commits into from
Feb 5, 2025
Merged

Conversation

flobernd
Copy link
Member

@flobernd flobernd commented Dec 3, 2024

Some analyzers had properties incorrectly marked as "required". As well added documentation for all documented fields.

This PR as well fixes different classes in various namespaces. These discrepancies have been found while working on the request converter. Thanks @l-trotta for double-checking my changes on base of the server code!

@flobernd flobernd requested review from pquentin, l-trotta and a team December 3, 2024 13:46
@flobernd flobernd force-pushed the improve-analyzers branch 2 times, most recently from 0bd910e to 9765060 Compare December 3, 2024 13:50
@l-trotta
Copy link
Contributor

l-trotta commented Dec 3, 2024

checked the snowball analyzer... it was deprecated in 3.1! imo it should really be removed from the server code
image

@l-trotta
Copy link
Contributor

l-trotta commented Dec 3, 2024

the version field is deprecated in every analyzer. server code

@l-trotta
Copy link
Contributor

l-trotta commented Dec 3, 2024

definitely not easy to check the code here, because it relies on Lucene classes a lot, but I think everything else looks good!

@flobernd
Copy link
Member Author

flobernd commented Dec 3, 2024

Thanks a lot for checking @l-trotta 🙂 Do you know which version of the server deprecated the version fields?

@l-trotta
Copy link
Contributor

l-trotta commented Dec 3, 2024

@flobernd 7.14.0! elastic/elasticsearch#74073

Copy link
Contributor

github-actions bot commented Dec 3, 2024

Following you can find the validation results for the APIs you have changed.

API Status Request Response
ingest.delete_geoip_database 🟢 1/1 1/1
ingest.delete_ip_location_database 🟠 Missing type Missing type
ingest.delete_pipeline 🟢 15/15 15/15
ingest.geo_ip_stats 🟢 1/1 1/1
ingest.get_geoip_database 🟢 6/6 6/6
ingest.get_ip_location_database 🟠 Missing type Missing type
ingest.get_pipeline 🟢 22/22 22/22
ingest.processor_grok 🟢 1/1 1/1
ingest.put_geoip_database 🟢 3/3 3/3
ingest.put_ip_location_database 🟠 Missing type Missing type
ingest.put_pipeline 🟢 60/60 60/60
ingest.simulate 🟢 10/10 10/10

You can validate these APIs yourself by using the make validate target.

Copy link
Contributor

@l-trotta l-trotta left a comment

Choose a reason for hiding this comment

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

LGTM!

@l-trotta l-trotta self-requested a review December 3, 2024 16:12
@l-trotta
Copy link
Contributor

l-trotta commented Dec 3, 2024

@pquentin the validation is failing because it's not finding sql.types.ts. we don't have it as a namespace in the spec, where is it getting it from? nevermind

@flobernd flobernd changed the title Improve Analyzer definitions Improve Analyzer definitions and fix various classes Dec 4, 2024
Copy link
Contributor

github-actions bot commented Dec 4, 2024

Following you can find the validation results for the APIs you have changed.

API Status Request Response
esql.query 274/274 Missing test
graph.explore 🟢 4/4 4/4
ingest.delete_geoip_database 🟢 1/1 1/1
ingest.delete_ip_location_database 🟠 Missing type Missing type
ingest.delete_pipeline 🟢 15/15 15/15
ingest.geo_ip_stats 🟢 1/1 1/1
ingest.get_geoip_database 🟢 6/6 6/6
ingest.get_ip_location_database 🟠 Missing type Missing type
ingest.get_pipeline 🟢 22/22 22/22
ingest.processor_grok 🟢 1/1 1/1
ingest.put_geoip_database 🟢 3/3 3/3
ingest.put_ip_location_database 🟠 Missing type Missing type
ingest.put_pipeline 🟢 60/60 60/60
ingest.simulate 🟢 10/10 10/10
snapshot.cleanup_repository 🟢 3/3 3/3
snapshot.clone 🟢 5/5 5/5
snapshot.create_repository 🔴 24/29 29/29
snapshot.create 🟢 28/28 28/28
snapshot.delete_repository 🟢 10/10 10/10
snapshot.delete 🔴 21/23 23/23
snapshot.get_repository 🔴 19/19 7/19
snapshot.get 🟢 13/13 13/13
snapshot.repository_analyze 🟠 Missing type Missing type
snapshot.repository_verify_integrity Missing test Missing test
snapshot.restore 🟢 5/5 5/5
snapshot.status 🟢 2/2 2/2
snapshot.verify_repository 🟢 2/2 2/2
sql.clear_cursor 🟢 1/1 1/1
sql.delete_async Missing test Missing test
sql.get_async_status Missing test Missing test
sql.get_async Missing test Missing test
sql.query 🟢 4/4 4/4
sql.translate 🔴 1/1 0/1

You can validate these APIs yourself by using the make validate target.

@flobernd flobernd requested review from a team as code owners December 13, 2024 11:47
Copy link
Contributor

Following you can find the validation results for the APIs you have changed.

API Status Request Response
esql.query 275/275 Missing test
graph.explore 🟢 4/4 4/4
ingest.delete_geoip_database 🟢 1/1 1/1
ingest.delete_ip_location_database 🟠 Missing type Missing type
ingest.delete_pipeline 🟢 15/15 15/15
ingest.geo_ip_stats 🟢 1/1 1/1
ingest.get_geoip_database 🟢 6/6 6/6
ingest.get_ip_location_database 🟠 Missing type Missing type
ingest.get_pipeline 🟢 22/22 22/22
ingest.processor_grok 🟢 1/1 1/1
ingest.put_geoip_database 🟢 3/3 3/3
ingest.put_ip_location_database 🟠 Missing type Missing type
ingest.put_pipeline 🟢 60/60 60/60
ingest.simulate 🟢 10/10 10/10
ml.clear_trained_model_deployment_cache 🟢 1/1 1/1
ml.close_job 🟢 64/64 63/63
ml.delete_calendar_event 🟢 4/4 4/4
ml.delete_calendar_job 🟢 3/3 3/3
ml.delete_calendar 🟢 5/5 5/5
ml.delete_data_frame_analytics 🟢 2/2 2/2
ml.delete_datafeed 🟢 3/3 3/3
ml.delete_expired_data 🟢 5/5 5/5
ml.delete_filter 🟢 27/27 27/27
ml.delete_forecast 🟢 3/3 3/3
ml.delete_job 🟢 47/47 47/47
ml.delete_model_snapshot 🟢 2/2 2/2
ml.delete_trained_model_alias 🟢 3/3 3/3
ml.delete_trained_model 🟢 5/5 5/5
ml.estimate_model_memory 🟢 16/16 16/16
ml.evaluate_data_frame 🟢 15/15 15/15
ml.explain_data_frame_analytics 🟢 7/7 7/7
ml.flush_job 🟢 15/15 15/15
ml.forecast 🟢 1/1 1/1
ml.get_buckets 🟢 14/14 14/14
ml.get_calendar_events 🟢 15/15 15/15
ml.get_calendars 🟢 17/17 17/17
ml.get_categories 🟢 12/12 12/12
ml.get_data_frame_analytics_stats 🟢 12/12 12/12
ml.get_data_frame_analytics 🟢 17/17 17/17
ml.get_datafeed_stats 🟢 27/27 27/27
ml.get_datafeeds 🔴 20/20 9/20
ml.get_filters 🟢 13/13 13/13
ml.get_influencers 🟢 11/11 11/11
ml.get_job_stats 🟢 32/32 32/32
ml.get_jobs 🔴 31/31 22/31
ml.get_memory_stats 🟢 6/6 6/6
ml.get_model_snapshot_upgrade_stats 🟢 3/3 3/3
ml.get_model_snapshots 🟢 18/18 18/18
ml.get_overall_buckets 🟢 16/16 15/15
ml.get_records 🟢 8/8 8/8
ml.get_trained_models_stats 🔴 17/17 12/17
ml.get_trained_models 🟢 37/37 37/37
ml.infer_trained_model 🟢 10/10 10/10
ml.info 🟢 10/10 10/10
ml.open_job 🟢 83/83 83/83
ml.post_calendar_events 🟢 12/12 12/12
ml.post_data 🔴 9/11 18/18
ml.preview_data_frame_analytics 🟢 3/3 3/3
ml.preview_datafeed 🟢 17/17 17/17
ml.put_calendar_job 🟢 12/12 12/12
ml.put_calendar 🟢 135/135 135/135
ml.put_data_frame_analytics 🟢 33/33 33/33
ml.put_datafeed 🔴 71/71 53/71
ml.put_filter 🟢 27/27 27/27
ml.put_job 🔴 227/227 223/225
ml.put_trained_model_alias 🟢 13/13 13/13
ml.put_trained_model_definition_part 🟢 1/1 1/1
ml.put_trained_model_vocabulary 🟢 1/1 1/1
ml.put_trained_model 🔴 8/16 16/16
ml.reset_job 🟢 2/2 2/2
ml.revert_model_snapshot 🟢 2/2 2/2
ml.set_upgrade_mode 🟢 6/6 6/6
ml.start_data_frame_analytics 🟢 1/1 1/1
ml.start_datafeed 🟢 24/24 24/24
ml.start_trained_model_deployment 🟢 14/14 14/14
ml.stop_data_frame_analytics 🟢 5/5 5/5
ml.stop_datafeed 🟢 17/17 17/17
ml.stop_trained_model_deployment 🟢 10/10 10/10
ml.update_data_frame_analytics 🟢 2/2 2/2
ml.update_datafeed 🔴 7/7 2/7
ml.update_filter 🟢 3/3 3/3
ml.update_job 🟢 5/5 5/5
ml.update_model_snapshot 🟢 3/3 3/3
ml.update_trained_model_deployment 🟢 4/4 4/4
ml.upgrade_job_snapshot 🟢 3/3 3/3
ml.validate_detector 🟢 2/2 2/2
ml.validate 🟢 3/3 3/3
snapshot.cleanup_repository 🟢 3/3 3/3
snapshot.clone 🟢 5/5 5/5
snapshot.create_repository 🔴 24/29 29/29
snapshot.create 🟢 28/28 28/28
snapshot.delete_repository 🟢 10/10 10/10
snapshot.delete 🔴 21/23 23/23
snapshot.get_repository 🔴 19/19 7/19
snapshot.get 🟢 13/13 13/13
snapshot.repository_analyze 🟠 Missing type Missing type
snapshot.repository_verify_integrity Missing test Missing test
snapshot.restore 🟢 5/5 5/5
snapshot.status 🟢 2/2 2/2
snapshot.verify_repository 🟢 2/2 2/2
sql.clear_cursor 🟢 1/1 1/1
sql.delete_async Missing test Missing test
sql.get_async_status Missing test Missing test
sql.get_async Missing test Missing test
sql.query 🟢 4/4 4/4
sql.translate 🔴 1/1 0/1

You can validate these APIs yourself by using the make validate target.

@flobernd
Copy link
Member Author

flobernd commented Feb 5, 2025

I removed the controversal change about the SQL + ESQL parameters for now as we decided to fix this in a separate PR.

Copy link
Contributor

github-actions bot commented Feb 5, 2025

Following you can find the validation results for the APIs you have changed.

API Status Request Response
graph.explore 🟢 4/4 4/4
ingest.delete_geoip_database 🟢 1/1 1/1
ingest.delete_ip_location_database 🟢 1/1 1/1
ingest.delete_pipeline 🟢 15/15 15/15
ingest.geo_ip_stats 🟢 1/1 1/1
ingest.get_geoip_database 🟢 6/6 6/6
ingest.get_ip_location_database 🟢 7/7 7/7
ingest.get_pipeline 🟢 22/22 22/22
ingest.processor_grok 🟢 1/1 1/1
ingest.put_geoip_database 🟢 3/3 3/3
ingest.put_ip_location_database 🟢 4/4 4/4
ingest.put_pipeline 🟢 60/60 60/60
ingest.simulate 🟢 10/10 10/10
ml.clear_trained_model_deployment_cache 🟢 1/1 1/1
ml.close_job 🟢 64/64 63/63
ml.delete_calendar_event 🟢 4/4 4/4
ml.delete_calendar_job 🟢 3/3 3/3
ml.delete_calendar 🟢 5/5 5/5
ml.delete_data_frame_analytics 🟢 2/2 2/2
ml.delete_datafeed 🟢 3/3 3/3
ml.delete_expired_data 🟢 5/5 5/5
ml.delete_filter 🟢 27/27 27/27
ml.delete_forecast 🟢 3/3 3/3
ml.delete_job 🟢 47/47 47/47
ml.delete_model_snapshot 🟢 2/2 2/2
ml.delete_trained_model_alias 🟢 3/3 3/3
ml.delete_trained_model 🟢 5/5 5/5
ml.estimate_model_memory 🟢 16/16 16/16
ml.evaluate_data_frame 🟢 15/15 15/15
ml.explain_data_frame_analytics 🟢 7/7 7/7
ml.flush_job 🟢 15/15 15/15
ml.forecast 🟢 1/1 1/1
ml.get_buckets 🟢 14/14 14/14
ml.get_calendar_events 🟢 15/15 15/15
ml.get_calendars 🟢 17/17 17/17
ml.get_categories 🟢 12/12 12/12
ml.get_data_frame_analytics_stats 🟢 12/12 12/12
ml.get_data_frame_analytics 🟢 17/17 17/17
ml.get_datafeed_stats 🟢 27/27 27/27
ml.get_datafeeds 🟢 20/20 20/20
ml.get_filters 🟢 13/13 13/13
ml.get_influencers 🟢 11/11 11/11
ml.get_job_stats 🟢 32/32 32/32
ml.get_jobs 🟢 31/31 31/31
ml.get_memory_stats 🟢 6/6 6/6
ml.get_model_snapshot_upgrade_stats 🟢 3/3 3/3
ml.get_model_snapshots 🟢 18/18 18/18
ml.get_overall_buckets 🟢 16/16 15/15
ml.get_records 🟢 8/8 8/8
ml.get_trained_models_stats 🔴 17/17 12/17
ml.get_trained_models 🟢 37/37 37/37
ml.infer_trained_model 🟢 10/10 10/10
ml.info 🟢 10/10 10/10
ml.open_job 🟢 83/83 83/83
ml.post_calendar_events 🟢 12/12 12/12
ml.post_data 🔴 9/11 18/18
ml.preview_data_frame_analytics 🟢 3/3 3/3
ml.preview_datafeed 🟢 17/17 17/17
ml.put_calendar_job 🟢 12/12 12/12
ml.put_calendar 🟢 135/135 135/135
ml.put_data_frame_analytics 🟢 33/33 33/33
ml.put_datafeed 🟢 71/71 71/71
ml.put_filter 🟢 27/27 27/27
ml.put_job 🟢 227/227 225/225
ml.put_trained_model_alias 🟢 13/13 13/13
ml.put_trained_model_definition_part 🟢 1/1 1/1
ml.put_trained_model_vocabulary 🟢 1/1 1/1
ml.put_trained_model 🔴 8/16 16/16
ml.reset_job 🟢 2/2 2/2
ml.revert_model_snapshot 🟢 2/2 2/2
ml.set_upgrade_mode 🟢 6/6 6/6
ml.start_data_frame_analytics 🟢 1/1 1/1
ml.start_datafeed 🟢 24/24 24/24
ml.start_trained_model_deployment 🟢 14/14 14/14
ml.stop_data_frame_analytics 🟢 5/5 5/5
ml.stop_datafeed 🟢 17/17 17/17
ml.stop_trained_model_deployment 🟢 10/10 10/10
ml.update_data_frame_analytics 🟢 2/2 2/2
ml.update_datafeed 🟢 7/7 7/7
ml.update_filter 🟢 3/3 3/3
ml.update_job 🟢 5/5 5/5
ml.update_model_snapshot 🟢 3/3 3/3
ml.update_trained_model_deployment 🟢 4/4 4/4
ml.upgrade_job_snapshot 🟢 3/3 3/3
ml.validate_detector 🟢 2/2 2/2
ml.validate 🟢 3/3 3/3
snapshot.cleanup_repository 🟢 3/3 3/3
snapshot.clone 🟢 5/5 5/5
snapshot.create_repository 🔴 24/29 29/29
snapshot.create 🟢 28/28 28/28
snapshot.delete_repository 🟢 10/10 10/10
snapshot.delete 🔴 21/23 23/23
snapshot.get_repository 🔴 19/19 7/19
snapshot.get 🟢 13/13 13/13
snapshot.repository_analyze Missing test Missing test
snapshot.repository_verify_integrity Missing test Missing test
snapshot.restore 🟢 5/5 5/5
snapshot.status 🟢 2/2 2/2
snapshot.verify_repository 🟢 2/2 2/2
sql.clear_cursor 🟢 1/1 1/1
sql.delete_async Missing test Missing test
sql.get_async_status Missing test Missing test
sql.get_async Missing test Missing test
sql.query 🟢 4/4 4/4
sql.translate 🔴 1/1 0/1

You can validate these APIs yourself by using the make validate target.

@flobernd flobernd merged commit 6209217 into main Feb 5, 2025
8 checks passed
@flobernd flobernd deleted the improve-analyzers branch February 5, 2025 09:55
Copy link
Contributor

github-actions bot commented Feb 5, 2025

The backport to 8.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-8.x 8.x
# Navigate to the new working tree
cd .worktrees/backport-8.x
# Create a new branch
git switch --create backport-3215-to-8.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 62092179e10298e6ff3b6dbfdbe68af8990119a3
# Push it to GitHub
git push --set-upstream origin backport-3215-to-8.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-8.x

Then, create a pull request where the base branch is 8.x and the compare/head branch is backport-3215-to-8.x.

Copy link
Contributor

github-actions bot commented Feb 5, 2025

The backport to 8.16 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-8.16 8.16
# Navigate to the new working tree
cd .worktrees/backport-8.16
# Create a new branch
git switch --create backport-3215-to-8.16
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 62092179e10298e6ff3b6dbfdbe68af8990119a3
# Push it to GitHub
git push --set-upstream origin backport-3215-to-8.16
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-8.16

Then, create a pull request where the base branch is 8.16 and the compare/head branch is backport-3215-to-8.16.

Copy link
Contributor

github-actions bot commented Feb 5, 2025

The backport to 8.17 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-8.17 8.17
# Navigate to the new working tree
cd .worktrees/backport-8.17
# Create a new branch
git switch --create backport-3215-to-8.17
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 62092179e10298e6ff3b6dbfdbe68af8990119a3
# Push it to GitHub
git push --set-upstream origin backport-3215-to-8.17
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-8.17

Then, create a pull request where the base branch is 8.17 and the compare/head branch is backport-3215-to-8.17.

Copy link
Contributor

github-actions bot commented Feb 5, 2025

The backport to 8.18 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-8.18 8.18
# Navigate to the new working tree
cd .worktrees/backport-8.18
# Create a new branch
git switch --create backport-3215-to-8.18
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 62092179e10298e6ff3b6dbfdbe68af8990119a3
# Push it to GitHub
git push --set-upstream origin backport-3215-to-8.18
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-8.18

Then, create a pull request where the base branch is 8.18 and the compare/head branch is backport-3215-to-8.18.

pquentin pushed a commit that referenced this pull request Feb 6, 2025
* [DOCS] Fix overlay for resolve cluster (#3670)

* Update specification output

* uppercase enum source mode (#3676)

* [DOCS] Add overlays for CCR API examples (#3672)

* Update inference.update.json with the correct verb (#3688)

* Update specification output

* [DOCS] Convert final examples from JSON to YAML (#3692)

* Update specification output

* Correcting the response format for ingest simulate (#3640)

* Correcting the response format for ingest simulate

* code review feedback

* moving error to the correct place, and adding ignored_fields

* Update specification/simulate/ingest/SimulateIngestResponse.ts

Co-authored-by: Laura Trotta <[email protected]>

---------

Co-authored-by: Laura Trotta <[email protected]>

* Update specification output

* Add text_embedding_bits to inference result output (#3698)

* Update specification output

* Improve `Analyzer` definitions and fix various classes (#3215)

* Update specification output

---------

Co-authored-by: Lisa Cawley <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Laura Trotta <[email protected]>
Co-authored-by: David Kyle <[email protected]>
Co-authored-by: Keith Massey <[email protected]>
Co-authored-by: Ying Mao <[email protected]>
@@ -309,7 +310,7 @@ export class ProcessorBase {
/**
* Conditionally execute the processor.
*/
if?: string
if?: Script
Copy link
Member

Choose a reason for hiding this comment

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

@flobernd I'm curious about whether this change is correct. I thought the if conditions for all ingest processors were represented only string values (that hold Painless expressions). If I understand correctly, this makes the if value into a struct which runs contrary to the pipelines processors I have used. Could you double check this please?

Copy link
Member Author

@flobernd flobernd Feb 7, 2025

Choose a reason for hiding this comment

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

Hey @andrewkroh, sure I will double check.

The driver for this change are some examples in our REST API documentation which do use a stroed script for the condition.

Copy link
Member Author

Choose a reason for hiding this comment

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

Documentation says:

You can also specify a stored script as the if condition.

The corresponding example is this one:

PUT _ingest/pipeline/my-pipeline
{
  "processors": [
    {
      "drop": {
        "description": "Drop documents that don't contain 'prod' tag",
        "if": { "id": "my-prod-tag-script" }
      }
    }
  ]
}

Our current Script type is defined like this:

/**
 * @shortcut_property source
 * */
export class Script {
  /**
   * The script source.
   */
  source?: string
  /**
   * The `id` for a stored script.
   */
  id?: Id
  // ...
}

Because of the "shortcut" to source, any JSON string literal is eqivalent to initializing a Script object and setting the source property to the value.

For example:

"if": "test"

is eqivalent to

"if": {
  "source": "test"
}

I just double checked in the Kibana dev console again and both requests (+ the one that uses id instead of source) do indeed work fine 🙂

Copy link
Member

Choose a reason for hiding this comment

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

Fantastic. My missing piece of knowledge was this @shortcut_property. Thank you!

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