Back

[SOLVED] Unable to create index in collection

  • 1
  • Databases
  • Cloud
code-spartan
16 Jun, 2023, 10:27

Since yesterday whenever I try to create an index in the collection, it shows the success toast on the top but in the cloud dashboard, it shows as failed. Is this a server issue or something going wrong on my end?

TL;DR
Issue: Unable to create index in collection. Error message: "Specified key was too long; max key length is 3072 bytes." User tried modifying attributes and creating a new collection but still unable to create index. Collection may be in an inconsistent state due to previous database upgrade/outage problems. Solution: Recreate the collection to clean up the inconsistent state. Full text indexes can only be created on string attributes, so check the attribute types. Consider using a string instead of integer for the "Time" attribute if ordering search results is needed. It is possible that the failure to create indexes is a server issue. User should provide
code-spartan
17 Jun, 2023, 02:55

Please provide an update on this issue it has been more than 12hrs.

Drake
17 Jun, 2023, 03:12

You can only have full text indexes on string attributes. What's the type on those time attributes?

code-spartan
17 Jun, 2023, 03:12

Time is int but I need it to order the search results.

Drake
17 Jun, 2023, 03:18

Ya same problem. Maybe you can use a (iso formatted) string instead?

code-spartan
17 Jun, 2023, 03:21

Ok I will try it out.

code-spartan
19 Jun, 2023, 09:46

Even creating a Full text index with a string attribute is not working. The index creation gets failed all the time.

Drake
19 Jun, 2023, 14:51

What's your project id?

code-spartan
19 Jun, 2023, 14:55

647ad9717a0ab865a248

Drake
19 Jun, 2023, 15:34

soooo your collection has somehow gotten into an inconsistent state. Were you creating indexes when we had our database upgrade/outage problems?

code-spartan
19 Jun, 2023, 15:34

I did create two of the indexes and although they show as failed they actually work.

Drake
19 Jun, 2023, 16:32

ya im not sure what happened. if you want to clean it up, the easiest thing to do would be to recreate the collection

code-spartan
19 Jun, 2023, 16:53

Okk I will try that out and give an update.

code-spartan
20 Jun, 2023, 07:08

Created a new collection based on the previous one however when I try to combine three fields in a index it still fails. Is this due to the inconsistent state or only two attributes can be combined in a index.

code-spartan
20 Jun, 2023, 07:40

Same issue unable to create index even with two attributes.

Drake
20 Jun, 2023, 23:07

the error was:

Specified key was too long; max key length is 3072 bytes

Drake
20 Jun, 2023, 23:08

this had the same error:

Specified key was too long; max key length is 3072 bytes

Drake
20 Jun, 2023, 23:09
code-spartan
21 Jun, 2023, 05:40

oh my bad I got it down now with some attribute modifications it works as intended. Thank you.

code-spartan
21 Jun, 2023, 05:41

[SOLVED]Unable to create index in collection

Drake
21 Jun, 2023, 16:01

[SOLVED] Unable to create index in collection

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more