I am using the test license. I configured elasticsearch, imported 5 million chat records, and returned 504 when querying. So I did a test to prove that elastic search was not used
Steps to reproduce
I have tried v5.31.0 and v5.36.1,
- Configure elasticsearch according to the document and close the database search
- restart the service
- send some message.
- then I modified the message in elasticsearch
- then I modified the message in mysql
After refreshing the page, I can search the contents in elasticsearch
Refresh the page and find that the message becomes the content in MySQL
A couple of questions to shed more light on this issue:
- How did you import the 5 million messages into Mattermost? Did you use bulk loading method or something else?
- How did you modify the message in ES? Would you mind sharing some screen shots here?
- When you mentioned that the message became the content in MySQL, can you elaborate a little further on that?
Ok, I import the messages by the command
mattermost import bulk posts.json --apply, it took about five hours to do this. Then I click the “Index Now” button. When the index success I can find all the data in elasticsearch. But when I search the history I got 504 in browser console.
Sorry, I can’t provide any screenshots for the moment. I changed the version to v5.20.0 yesterday. There is no elasticsearch problem in this version. I can repeat this problem later with v5.36.1.
About the message change to the content in Mysql the fastest test method is
truncate table Posts;, Then refresh the page and you will find that all the messages are gone
Did you purge the indexes first before clicking the index not button based on the changelog entry here:
- In v5.26, Elasticsearch indexes needed to be recreated. Admins should re-index Elasticsearch using the Purge index and then Index now button so that all the changes will be included in the index. Systems may be left with a limited search during the indexing, so it should be done during a time when there is little to no activity because it may take several hours.
I went through the rest of the changelog and could not find any specific breaking changes in between version 5.20.0 and 5.36.1 since you mentioned that it works in the earlier version. So, just trying to understand this further before I escalate this internally.
Also, may I know the reason behind running the
TRUNCATE table command? As far as I know it deletes the content of the table but not the table itself. Were you importing the 5 million messages to an existing Mattermost installation that was running on different versions compared to the origin?
I deployed in a new virtual machine. There is no data in elasticsearch and mysql.I run this command mainly to verify whether the search is still using mysql. I guess if the search does not use mysql, deleting the data in MySQL should not affect the search results.Now we are testing v5.20.0, I have imported 5 million data, and the query has not encountered any problems.
I read part of the source code, I think the problem may be in mattermost-server/server.go at master · mattermost/mattermost-server · GitHub ，I don’t understand why s. sqlstore is used here.
@ahmaddanial Do we need devs to take a look?
Hi, @Zsyh2619 @amy.blais
Sorry for the delayed response. I was on PTO for a bit.
Yes, please. I think it is best for the devs to look into this issue for us to understand the reason behind this issue.