How to rename an index in the dashboard using a forward slash

I’m using the RealTimeDatabase, the name of my current index is sneakers, all of my searchable attributes are there, and everything works fine. I’ve decided to move all of the attributes one level deeper to sneakers/brands, and set the brands part as the index. The issue is when I went to the console to rename the index it kept failing.

It says " Please confirm by typing the index name sneakers", which I did.

Then it says “New index name” and when I enter sneakers/brands and press rename it says “Failed to rename index.”. I’m assuming it’s because of the forward slash.

How can I set the index name in the console to sneakers/brands?

My db layout now and the searchable attributes are name and condition:

@sneakers
      @postId_123
               -condition: used
               -name: nike
               -price: 90
      @postId_456
               -condition: new
               -name: adidas
               -price: 200

// in my view controller: apiClient.index(withName: "sneakers")
// in my index.js file: client.initIndex('sneakers')

What I want to update it to (I haven’t made the changes yet):

@sneakers
     @brands
          @postId_123
               -condition: used
               -name: nike
               -price: 90
          @postId_456
               -condition: new
               -name: adidas
               -price: 200

// in my view controller: apiClient.index(withName: "sneakers/brands")
// in my index.js file: client.initIndex('sneakers/brands')

Hello,

As you guessed forward slash are not allowed. You can find the complete list of allowed characters here: What can I name my indices? | Configuration & Relevance FAQ | Docs Algolia

I’ll suggest to have a function to format your index name or simply put an underscore.

Best regards

@
samuel.bodin
Hi, thanks for the reply. What do you mean “have a function to format my index name”? If I put an underscore does that also match what’s inside the db, for example.

If my db is

@sneakers
       @brands
              @postId

that is not the same as

@sneakers_brands
            @postId

or does the dashboard identify the underscore as a “line break”?

Algolia is database agnostic, so that means we will probably never match 1:1 with all the Database system. It’s up to you to find the name you want for your index and for your props.
What I suggest is on your indexing script, instead of using a slash, you use an underscore (but any other char will do the trick). In other word the index name does not matter, you could have used foobar it would have worked too.

# index.js
-client.initIndex('sneakers/brands')
+client.initIndex('sneakers_brands')
# controller.js
-apiClient.index(withName: "sneakers/brands")
+apiClient.index(withName: "sneakers_brands")

@samuel.bodin ahhhhh, ok thanks. I was under the impression that what’s in the dashboard had to exactly match what was inside the index.js file. I got you know. Much appreciated, Cheers!!!

@samuel.bodin I had to work on another project and just got back to this today. To query a nested level down, in the dashboard I had to add this to Searchable Attributes and Attributes to Retrieve:

brands, brands.condition, brands.name, brands.price