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

[Saved objects] Searching in Stack Management/Saved objects throws an error notification #112659

Closed
mbondyra opened this issue Sep 21, 2021 · 8 comments · Fixed by #112745
Closed
Labels
bug Fixes for quality problems that affect the customer experience Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.16.0

Comments

@mbondyra
Copy link
Contributor

Kibana version:
master

Steps to reproduce:

  1. Go to http://localhost:5601/app/management/kibana/objects
  2. In the search box, type any string and press enter
  3. You’ll see a notification displayed:

Screenshot 2021-09-21 at 14 16 29

Details:

Looking at the network:

Both calls:
http://localhost:5601/api/kibana/management/saved_objects/scroll/counts
and
http://localhost:5601/api/kibana/management/saved_objects/_find?search=lens*&perPage=50&page=1&fields=id&type=config&type=url&type=query&type=index-pattern&type=visualization&type=tag&type=canvas-element&type=canvas-workpad&type=graph-workspace&type=action&type=alert&type=dashboard&type=map&type=lens&type=cases-comments&type=cases&type=cases-user-actions&type=search&type=infrastructure-ui-source&type=metrics-explorer-view&type=inventory-view&type=apm-indices&sortField=type

throws 400 error with message: "all shards failed: search_phase_execution_exception: [query_shard_exception] Reason: failed to create query: Can only use phrase prefix queries on text fields - not on [cases.title] which is of type [keyword]"

@mbondyra mbondyra added bug Fixes for quality problems that affect the customer experience Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc labels Sep 21, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@mbondyra mbondyra changed the title [Stack management] Searching in Stack Management/Saved objects throws an error notification [Saved objects] Searching in Stack Management/Saved objects throws an error notification Sep 21, 2021
@rudolf
Copy link
Contributor

rudolf commented Sep 21, 2021

This seems to be have been caused by #110148, now that cases are importable/exportable we're also searching over them, but our query doesn't work on keyword fields. I didn't know title needs to be of type text and I don't think it's documented anywhere, so we should look at ways to enforce this.

@jonathan-buttner @elastic/security-threat-hunting is there a good reason cases.title is of type keyword, what would be the implication of changing this to text?

@rudolf rudolf added the v7.16.0 label Sep 21, 2021
@pgayvallet
Copy link
Contributor

pgayvallet commented Sep 21, 2021

I didn't know title needs to be of type text and I don't think it's documented anywhere, so we should look at ways to enforce this.

That's not exactly it. A type's defaultSearchField must be of type text (even if that's not documented anywhere...). Also, as we build a query for every searchable fields for every type, each type must have each other type's searchableField either non-present or of type text (yes, this is plain terrible).

@jonathan-buttner
Copy link
Contributor

Ah dang, I must have totally missed that in my testing! I think moving title to a text field is probably fine. @cnasikas @XavierM do you see any issues with that? @rudolf we should be able to do that as part of a migration for 7.16 to fix this right?

@pgayvallet
Copy link
Contributor

we should be able to do that as part of a migration for 7.16 to fix this right?

Just changing the mapping in your type definition should do it.

@jonathan-buttner
Copy link
Contributor

Just changing the mapping in your type definition should do it.

Oh, so just to confirm when changing the type of a field you don't have to do it as part of a migration? Is that because all the documents are inserted on upgrade?

@pgayvallet
Copy link
Contributor

Is that because all the documents are inserted on upgrade?

Correct, all the documents are re-indexed from the old index to the new one during the SO migration occurring during a version upgrade.

@lukeelmers lukeelmers removed the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Sep 22, 2021
@cnasikas cnasikas added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) and removed Team:Threat Hunting:Cases labels Jan 10, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@kobelb kobelb added the needs-team Issues missing a team label label Jan 31, 2022
@botelastic botelastic bot removed the needs-team Issues missing a team label label Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.16.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants