• Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login
FusionAuth
  • Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login

ElasticSearch reindex doesn't reindex all documents

Scheduled Pinned Locked Moved Unsolved
Comments & Feedback
2
4
12.2k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y
    yves
    last edited by 22 May 2023, 07:26

    I've got a question regarding the reindexing of the ElasticSearch fusionauth_user index.

    When we perform a reindex it seems that some users/documents get "lost".

    Some observations:

    • We've enabled debugging on ElasticSearch and don't see any errors being thrown when the index is dropped and recreated.
    • The query that fails afterwards is a "nested" search for a particular registration users have.
    • When we PATCH or lock/unlock users then they appear in the ElasticSearch index again and the query succeeds.

    What happens when the reindex is performed? I'm struggling to understand why or how this could happen because I assumed all users/documents are inserted in the new index again?

    Right now our workaround is to PATCH all users so that we can be sure that they're in the index.

    Any ideas? Pointers?

    D 1 Reply Last reply 22 May 2023, 20:15 Reply Quote 1
    • D
      dan @yves
      last edited by 22 May 2023, 20:15

      Hmmm. I looked at the code path and can't see any reason that registrations would be omitted when reindexing, which would be one reason the search might fail.

      • What version of FusionAuth are you running?
      • What version of ES are you running?
      • After reindex, if you search for a user with a registration (by something other than that nested search), is the registration data present?
      • Any other searches fail?
      • Any other troubleshooting steps you can share?
      • Reindexing typically doesn't need to be done very often. Roughly how often are you reindexing (and why)?

      Thanks!

      --
      FusionAuth - Auth for devs, built by devs.
      https://fusionauth.io

      Y 1 Reply Last reply 23 May 2023, 16:14 Reply Quote 0
      • Y
        yves @dan
        last edited by 23 May 2023, 16:14

        Thanks for the reply @dan!

        Will answer inline.

        @dan said in ElasticSearch reindex doesn't reindex all documents:

        Hmmm. I looked at the code path and can't see any reason that registrations would be omitted when reindexing, which would be one reason the search might fail.

        • What version of FusionAuth are you running?

        We're currently on 1.34.0.

        • What version of ES are you running?

        That would be 6.8.16.

        • After reindex, if you search for a user with a registration (by something other than that nested search), is the registration data present?

        No, the query wouldn't yield any result, it's like the user/document doesn't exist in the search index.

        • Any other searches fail?

        As mentioned above, also searching directly via id for example fails.

        • Any other troubleshooting steps you can share?

        Unfortunately not. Apologies, it's a tricky one!

        • Reindexing typically doesn't need to be done very often. Roughly how often are you reindexing (and why)?

        I'd say we reindex once a month. Usually because we run into trouble with our user data. For example we migrate something in the user data and then data types have a mismatch and the ElasticSearch index is refusing to index the document. Then FusionAuth returns the "A request to the search index has failed. This error is unexpected. Contact Support." 503 and we need to "manually" fix this correcting the mistake in the user data and then running the reindex. It's all a bit suboptimal.

        Thanks!

        Any ideas?

        D 1 Reply Last reply 3 Jun 2023, 20:54 Reply Quote 0
        • D
          dan @yves
          last edited by 3 Jun 2023, 20:54

          @yves

          I'd be interested to see if the same issue occurs on the latest version of FusionAuth. There's 4-5 mentions of Elasticsearch in the release notes between 1.34.0 and 1.45.3, but none of them appear to address what you are seeing.

          As mentioned above, also searching directly via id for example fails.

          Sorry, I missed that. Are you saying when you search using the ids method (described here under the heading Search for Users by Id) it doesn't find these users? Because that search should go directly to the database and not through ES at all.

          It's all a bit suboptimal.

          Off topic, but please consider adding your voice to this issue which might help with your schema changes.

          --
          FusionAuth - Auth for devs, built by devs.
          https://fusionauth.io

          1 Reply Last reply Reply Quote 0
          • First post
            Last post