Search doesn't find users which are Agents also

  • Used Zammad version: 3.1
  • Used Zammad installation source: Package
  • Operating system: Ubuntu 18.04 LTS
  • Browser + version: Firefox, Chrome

I got the Problem that the Zammad Search doesn’t work correctly. Some Users i can find and some not. I don’t where the Problem is? How i can found out what’s the problem?

Example: Iam looking for my name, i found it. Iam looking for a user from a another department, Zammad doesn’t find it.

Edit: The Problem seems to be that the Zammad Search can’t find users which are Agents. Is there a way to resolve this problem? A lot of users are at the same time Agents

Could you please share what exactly you’re doing do reproduce this?
Most proberbly is a faulty search index for whatever reason.

Try reindexing and check if the issue persists / appears again.

I want to create a Ticket for the Customer “Claudia Zammad” for Example. Claudia Zammad is also Agent in a another Group (outside my Group). When i enter “Claudia”,“Zammad” or “Claudia Zammad” i don’t get her in the list.

I’ve got the same Behavior when i’am using the Search Function in Zammad. I don’t get her as a result.

What iam done already:

zammad run rake searchindex:rebuild - the Problem still exists

then i tried:

zammad run rails r "Setting.set('es_url', 'http://localhost:9200')"
zammad run rake searchindex:rebuild

without any result. Elasticsearch is running, the curl command looks normal. I rebooted the Server now, but i can’t still find her.

Do you happen to have more than 50 results?
You could also try the following to enforce reindexing a single user:

User.find_by(mail:'mail@address.here').search_index_update
Check if the Delayed Jobs get worked:
Delayed::Job.count

If it never hits zero, you have an issue with indexing. Logfiles might help there.

Which Log File do you need exactly? We got one User for “Claudia Zammad”.

User.find_by(mail:'mail@address.here').search_index_update
Check if the Delayed Jobs get worked:
Delayed::Job.count

When i enter this commands i got the following error:

-bash: syntax error near unexpected token `(’

If i got a Problem with indexing, how i could resolve it? Could a Elasticsearch Upgrade from 5.6 to 6.X or 7.X help?

My bad, you want to run my commands in a rails console… :wink:
zammad run rails c

The interesting logfile should be Zammads production.log ( /var/log/zammad/ )

Theoretically this shouldn’t make a big difference, but as ES5.6 is reaching EOL anyway, it wouldn’t harm. But again, the root of the issue might stay the same.

How i can upload here the Log File?

sudo zammad run rails c User.find_by(mail:‘claudia.zammad@domain.com’).search_index_update

Is the command so correct? Because iam getting still the Error:

-bash: syntax error near unexpected token `(’

I started a little Ubuntu Test Server for Elasticsearch Upgrade Test. Would it be a Problem for Zammad if i remove ES 5.6 completly and install ES 7.4? After the Installation i would run the following command:

zammad run rails r “Setting.set(‘es_url’, ‘http://localhost:9200’)”

If you want it that way, c (for console) would be wrong.
This command should help:
zammad run rails r "User.find_by(mail:'claudia.zammad@domain.com').search_index_update"

No, shouldn’t be any issue, however, cleanup all Elasticsearch configs and data directories as well.
Rebuild is required afterwards.

Now the Command works. Iam getting the following Error after running it:

Traceback (most recent call last):
38: from /opt/zammad/bin/rails:9:in <main>' 37: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in require’
36: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in load_dependency' 35: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in block in require’
34: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in require' 33: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in require_with_bootsnap_lfi ’
32: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in register' 31: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in block in require_with_boo tsnap_lfi’
30: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in require' 29: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in
28: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/command.rb:46:in invoke' 27: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/command/base.rb:65:in perform’
26: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in dispatch' 25: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in invoke_command’
24: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in run' 23: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/commands/runner/runner_command.rb:41:in perform’
22: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/commands/runner/runner_command.rb:41:in eval' 21: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/commands/runner/runner_command.rb:41:in
20: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/core.rb:197:in find_by' 19: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/querying.rb:9:in find_by’
18: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/relation/finder_methods.rb:81:in find_by' 17: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/relation/finder_methods.rb:103:in take’
16: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/relation/finder_methods.rb:504:in find_take' 15: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/relation.rb:200:in records’
14: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/relation.rb:422:in load' 13: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/relation.rb:547:in exec_queries’
12: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/relation.rb:584:in skip_query_cache_if_necessary' 11: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/relation.rb:560:in block in exec_queries’
10: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/querying.rb:41:in find_by_sql' 9: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/query_cache.rb:106:in select_all’
8: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:68:in select_ all' 7: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:482:in select _prepared’
6: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:81:in exec_ query' 5: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:600:in execute_and_clea r’
4: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:617:in exec_cache' 3: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:672:in prepare_statemen t’
2: from /opt/zammad/vendor/ruby-2.5.5/lib/ruby/2.5.0/monitor.rb:226:in mon_synchronize' 1: from /opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:677:in block in prepare _statement’
/opt/zammad/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:677:in `prepare’: PG::UndefinedColumn: ER ROR: column users.mail does not exist (ActiveRecord::StatementInvalid)
LINE 1: SELECT “users”.* FROM “users” WHERE “users”.“mail” = $1 LIM…
^
HINT: Perhaps you meant to reference the column “users.email”.
: SELECT “users”.* FROM “users” WHERE “users”.“mail” = $1 LIMIT $2

Some Update to this Topic:

Today i’ve updatet Elasticsearch, removed for the Upgrade all indices and rebuild them after the Upgrade. But Zammad still doesn’t finde one the same user.

From which ES to which ES version did you upgrade?
Did you follow the upgrade path?

@MrGeneration

I’ve updated from ES 5.6 to ES 6.8 without any Problems. I removed before the Update all Indices, updated ES and rebuild the Indices with Zammad.

Oh boy I’m terribly sorry.
I messed up the commend, you want to use:

zammad run rails r "User.find_by(email: 'claudia.zammad@domain.com').search_index_update"

That should help better.
Don’t forget to do a complete rebuild if not already done, you should be fine after wards.

Now the Command is working. But this also doesn’t help. I’ve did a complete rebuild after the ES Update.

I don’t know whats the Problem with this one Person. Here is the Output from the Rebuild:

sudo zammad run rake searchindex:rebuild --trace
** Invoke searchindex:rebuild (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute searchindex:rebuild
** Execute searchindex:drop
drop indexes...done
** Execute searchindex:drop_pipeline
delete pipeline (pipeline)... done
** Execute searchindex:create
create indexes...done
** Execute searchindex:create_pipeline
create pipeline (pipeline)... done
** Execute searchindex:reload
reload data...
 reload StatsStore
  - started at 2020-01-09 05:06:27 UTC
  - took 27 seconds
 reload Organization
  - started at 2020-01-09 05:06:54 UTC
  - took 1 seconds
 reload Ticket
  - started at 2020-01-09 05:06:55 UTC
  - took 1756 seconds
 reload KnowledgeBase::Category::Translation
  - started at 2020-01-09 05:36:12 UTC
  - took 1 seconds
 reload KnowledgeBase::Answer::Translation
  - started at 2020-01-09 05:36:14 UTC
  - took 4 seconds
 reload KnowledgeBase::Translation
  - started at 2020-01-09 05:36:18 UTC
  - took 0 seconds
 reload User
  - started at 2020-01-09 05:36:19 UTC
  - took 51 seconds
 reload Cti::Log
  - started at 2020-01-09 05:37:11 UTC
  - took 0 seconds
 reload Chat::Session
  - started at 2020-01-09 05:37:11 UTC
  - took 0 seconds

After rebuild you still can’t find this user?!

Correct, after a Rebuild i still can’t find this one user. The only way to find this user is over the E-Mail. Iam not sure if there are more users with the same problem, but i found only this one till now :wink:

Just a follow up because this was support work out of this scope:
We could verify the root cause being an attribute holding the users first and lastname which caused Zammad to show the latest 10 results being updated. The searched user was no longer in the visible search results.

We’re currently investigating this and checking if there’s a useful workaround for this.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.