Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-28060

Some words make simple full text search very slow

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Text Search
    • None
    • ALL

      Full text search is very slow:

      > db.poi.find({"$text":{"$search":"printer"}}, {'_id': 1}).limit(10);
      { "_id" : ObjectId("56f32ef56e95524b6cf81bc5") }
      { "_id" : ObjectId("5628e2d3a8a0845397884d55") }
      { "_id" : ObjectId("56f2e6b76e95524b6ccd4eae") }
      { "_id" : ObjectId("56f2f6936e95524b6cd73cd3") }
      { "_id" : ObjectId("56f331c16e95524b6cf9acb1") }
      { "_id" : ObjectId("55eec042a8a08408a451110a") }
      { "_id" : ObjectId("55eed93aa8a08408a4537784") }
      { "_id" : ObjectId("55eeee94a8a0843cfd754ff7") }
      { "_id" : ObjectId("5628ae67a8a084539786d10e") }
      { "_id" : ObjectId("56f2e4566e95524b6ccbd042") }
      Fetched 10 record(s) in 4183ms
      

      4 seconds on such query is very big time. Ok, it is passably, but...

      > db.poi.find({"$text":{"$search":"cafe"}}, {'_id': 1}).limit(10);
      { "_id" : ObjectId("566bc1c1a8a084299e635ebb") }
      { "_id" : ObjectId("567214bda8a0840b52f10708") }
      { "_id" : ObjectId("566bb446a8a084299e627dd8") }
      { "_id" : ObjectId("56f2ee7c6e95524b6cd230b0") }
      { "_id" : ObjectId("56f32c7f6e95524b6cf6c3e3") }
      { "_id" : ObjectId("56f2ed706e95524b6cd18ad4") }
      { "_id" : ObjectId("566bb670a8a084299e6298d2") }
      { "_id" : ObjectId("566bc1f6a8a084299e6361ea") }
      { "_id" : ObjectId("566bc618a8a084299e63af4e") }
      { "_id" : ObjectId("56f307f96e95524b6ce1b8ca") }
      Fetched 10 record(s) in 271405ms
      

      This is madness!

      My environment:

      > version();
      3.4.2
      > db.poi.count();
      26929589
      > db.poi.getIndexes();
      ...
      {
      		"v" : 1,
      		"key" : {
      				"_fts" : "text",
      				"_ftsx" : 1
      		},
      		"name" : "text_index",
      		"ns" : "poi.poi",
      		"default_language" : "english",
      		"weights" : {
      				"name" : 1,
      				"shortAddr" : 1,
      				"tags.types" : 1
      		},
      		"language_override" : "language",
      		"textIndexVersion" : 3
      }
      ...
      
      > db.stats();
      {
              "db" : "poi",
              "collections" : 9,
              "views" : 0,
              "objects" : 65770165,
              "avgObjSize" : 681.1554679846097,
              "dataSize" : 44799707520,
              "storageSize" : 22752616448,
              "numExtents" : 0,
              "indexes" : 88,
              "indexSize" : 10810482688,
              "ok" : 1
      }
      

      Storage engine is default (wired tiger).

            Assignee:
            kelsey.schubert@mongodb.com Kelsey Schubert
            Reporter:
            kazankov Sergey Kazankov
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: