# \[SOLVED\] Missing users in @-autocomplete

**URL:** https://forum.mattermost.com/t/solved-missing-users-in-autocomplete/3145
**Category:** Troubleshooting
**Created:** [April 12, 2017, 9:52am UTC](https://forum.mattermost.com/t/solved-missing-users-in-autocomplete/3145 "2017-04-12T09:52:36Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![gubbins](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@gubbins](https://forum.mattermost.com/u/gubbins)
#### Post date: [April 12, 2017, 9:52am UTC](https://forum.mattermost.com/t/solved-missing-users-in-autocomplete/3145/1 "2017-04-12T09:52:36Z")

</div>

#### Summary

Some users don’t appear in the autocomplete box that pops up for @-mentions or search.

#### Steps to reproduce

Server version 3.7.1, various clients. Either:

- in the Post area, type @
- in the search box, type from:

#### Expected behavior

All active users should be visible.

#### Observed behavior

Some users are entirely missing from the autocomplete list - however, if the full username is typed, the @-mention works normally.

The same users are still missing after a restart of the server and missing regardless of the current channel in the client.

I can’t discern any pattern in the users that are missing (nor do I know the complete list).

BTW we have about 300 users in the team, if that makes any difference.

---

<div class="post-metadata">

### Author: ![lindy](https://avatars.discourse-cdn.com/v4/letter/l/3ab097/32.png) [@lindy](https://forum.mattermost.com/u/lindy)
#### Post date: [April 17, 2017, 9:11am UTC](https://forum.mattermost.com/t/solved-missing-users-in-autocomplete/3145/2 "2017-04-17T09:11:01Z")

</div>

Hi @gubbins,

Thanks for your report!

Mattermost 3.8.0 has been released. Could you try upgrading your installation to the [latest version](https://about.mattermost.com/download/) and see whether the issue reproduces for you?

Thanks!

---

<div class="post-metadata">

### Author: ![gubbins](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@gubbins](https://forum.mattermost.com/u/gubbins)
#### Post date: [April 17, 2017, 7:44pm UTC](https://forum.mattermost.com/t/solved-missing-users-in-autocomplete/3145/3 "2017-04-17T19:44:11Z")

</div>

Will do @lindy, but I might wait for 3.8.1 since we use Gitlab for auth and I saw on the release notes that there’s an issue with that in 3.8.0.

---

<div class="post-metadata">

### Author: ![lindy65](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/lindy65/32/1811_2.png) [@lindy65](https://forum.mattermost.com/u/lindy65)
#### Post date: [April 18, 2017, 9:13am UTC](https://forum.mattermost.com/t/solved-missing-users-in-autocomplete/3145/4 "2017-04-18T09:13:16Z")

</div>

Sounds good @gubbins! Thanks 🙂

Let us know how it goes!

---

<div class="post-metadata">

### Author: ![gubbins](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@gubbins](https://forum.mattermost.com/u/gubbins)
#### Post date: [April 27, 2017, 2:56am UTC](https://forum.mattermost.com/t/solved-missing-users-in-autocomplete/3145/5 "2017-04-27T02:56:59Z")

</div>

I just upgraded to 3.8.2. Unfortunately the behaviour is unchanged.

It also seems to be getting more prevalent (by which I mean the number of users missing in autocomplete seems to be increasing, and more users are noticing the problem and getting frustrated).

Even worse, it’s hard to open direct chats to affected users - creating a chat and typing in their username doesn’t work (they’re not in the popup, but even if you type their correct username anyway, you can’t add them to the list). The only way I know of to open a direct chat is to click on their avatar in a channel and use the Send Message link, which does still work.

There are no errors in the log since restart (set to INFO level).

This has become a fairly big problem for us. I am surprised nobody else has reported it - I am wondering what could be different in our installation.

---

<div class="post-metadata">

### Author: ![gubbins](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@gubbins](https://forum.mattermost.com/u/gubbins)
#### Post date: [April 27, 2017, 4:10am UTC](https://forum.mattermost.com/t/solved-missing-users-in-autocomplete/3145/6 "2017-04-27T04:10:34Z")

</div>

One more observation: if we just type the @ sign, then the pop-up list is complete and we can scroll through and see everyone; it’s only as we start to type letters that we get incomplete results.

---

<div class="post-metadata">

### Author: ![lindy65](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/lindy65/32/1811_2.png) [@lindy65](https://forum.mattermost.com/u/lindy65)
#### Post date: [April 27, 2017, 9:41am UTC](https://forum.mattermost.com/t/solved-missing-users-in-autocomplete/3145/7 "2017-04-27T09:41:45Z")

</div>

Hi @gubbins,

I’ve just had a thought but will need you to test it out to see whether this might be your issue…

Can you go to your “Town Square” channel and

1. type `@` in the center channel message box
2. in the search box type `in:town-square from:`

Can you compare the list of names that appears for 1. and 2. above and let me know whether they’re the same?

I think the issue you might be experiencing is that typing `@` in any channel only brings up a list of channel members whereas typing `from:` in the search box brings up a list of all users on the team.

Let me know how it goes.

Thanks!

---

<div class="post-metadata">

### Author: ![gubbins](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@gubbins](https://forum.mattermost.com/u/gubbins)
#### Post date: [April 27, 2017, 10:26am UTC](https://forum.mattermost.com/t/solved-missing-users-in-autocomplete/3145/8 "2017-04-27T10:26:13Z")

</div>

OK, so just looking at users whose usernames start with c as an example:

- in Town Square, type `@` and then scroll down
  - under C, I see all 18 users whose usernames start with c

- in Town Square, type `@c`
  - under C, I now only see 4 users

- in the search box, type `from:`
  - under C, I see all 18 users

- in the search box, type `from:c`
  - under C, I see only 4 (the same 4 as above)

- in the search box, type `in:town-square from:`
  - under C, I see all 18 users

- in the search box, type `in:town-square from:c`
  - under C, I see only 4 (the same 4 as above)

The filtering by letter always seems to cut out the same users regardless of the channel in which I do it (or indeed the dialog used to create new Direct Messages, as mentioned). I think something is going wrong in that filtering.

---

<div class="post-metadata">

### Author: ![lindy65](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/lindy65/32/1811_2.png) [@lindy65](https://forum.mattermost.com/u/lindy65)
#### Post date: [April 27, 2017, 11:14am UTC](https://forum.mattermost.com/t/solved-missing-users-in-autocomplete/3145/9 "2017-04-27T11:14:52Z")

</div>

Hi @gubbins!

Thanks for the feedback!

When using `from:` in the searchbox, your own logged in username will also appear in the list so this will add one user to the overall list (as you can also search for messages from yourself).

That said, I’m not able to reproduce the disappearing users as you’ve detailed in your steps above. I’m thinking it might be because there is a problem with the GitLab omnibus installation.

I’m going to link in @eric, one of our product specialists who might be able to shed some light on the issue.

Let’s see whether we can get to the root cause of your issue!

---

<div class="post-metadata">

### Author: ![gubbins](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@gubbins](https://forum.mattermost.com/u/gubbins)
#### Post date: [April 27, 2017, 11:23am UTC](https://forum.mattermost.com/t/solved-missing-users-in-autocomplete/3145/10 "2017-04-27T11:23:21Z")

</div>

Thanks @lindy65 (but note we’re not using the GitLab omnibus installation)

In other news, I reverse-engineered the MySQL query that I believe will get run on the server for such autocomplete queries, having traced it back to [https://github.com/mattermost/platform/blob/master/store/sql\_user\_store.go](https://github.com/mattermost/platform/blob/master/store/sql_user_store.go). For our Town Square channel, with just “c” as the search term, I believe it would be this:

```
SELECT Users.FirstName FROM Users, ChannelMembers WHERE ChannelMembers.ChannelId = '8r95qhjqgirhmpx6nxt6f83kuh' AND ChannelMembers.UserId = Users.Id AND MATCH(Username, FirstName, LastName, Nickname, Email) AGAINST ('+c*' IN BOOLEAN MODE);

```

Interestingly, the results of this again include only 4 users with usernames starting with c (not all 18). If I understand the query right, it should include all 18 users whose usernames start with c. I played with some variations of the query and got some rather odd results. I wonder if there’s some issue with our MySQL version, or the index is corrupt or something?

---

<div class="post-metadata">

### Author: ![lindy65](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/lindy65/32/1811_2.png) [@lindy65](https://forum.mattermost.com/u/lindy65)
#### Post date: [April 27, 2017, 11:29am UTC](https://forum.mattermost.com/t/solved-missing-users-in-autocomplete/3145/11 "2017-04-27T11:29:16Z")

</div>

Ah sorry, I misunderstood. I see you’re just using GitLab for auth!

I’m sure Eric will have some additional thoughts / suggestions. In the meantime, thought I’d let you know that we are working on improving search and have elastic search on the roadmap for next release on May 16th.

---

<div class="post-metadata">

### Author: ![gubbins](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@gubbins](https://forum.mattermost.com/u/gubbins)
#### Post date: [April 27, 2017, 11:32am UTC](https://forum.mattermost.com/t/solved-missing-users-in-autocomplete/3145/12 "2017-04-27T11:32:19Z")

</div>

OK.

@eric, since the queries I run directly produce the same results as the autocompletes in the client, I think it must be an issue with our DB - do you agree? I just don’t get results I understand for those queries…

---

<div class="post-metadata">

### Author: ![gubbins](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@gubbins](https://forum.mattermost.com/u/gubbins)
#### Post date: [April 28, 2017, 12:56am UTC](https://forum.mattermost.com/t/solved-missing-users-in-autocomplete/3145/13 "2017-04-28T00:56:24Z")

</div>

@eric / @lindy65 - this appears to be resolved after running `optimize table Users` on our database, to force re-creation of indices. The SQL queries seem to work as expected and our autocompletes look like they’re working again.

I am not sure how the index got in a bad state in the DB but likely nothing to do with mattermost itself!

---

<div class="post-metadata">

### Author: ![lindy65](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/lindy65/32/1811_2.png) [@lindy65](https://forum.mattermost.com/u/lindy65)
#### Post date: [April 28, 2017, 6:59am UTC](https://forum.mattermost.com/t/solved-missing-users-in-autocomplete/3145/14 "2017-04-28T06:59:47Z")

</div>

That’s great news @gubbins! Glad to hear your issue is resolved!

I’ll mark this as resolved for now but please let us know if there’s anything else we can help with…
