Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8978639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:39:48+00:00 2026-06-15T19:39:48+00:00

How do I check whether an index exists? – before calling: IndexCreation.CreateIndexes(typeof(MyIndexClass).Assembly, documentStore); All

  • 0

How do I check whether an index exists? – before calling:

IndexCreation.CreateIndexes(typeof(MyIndexClass).Assembly, documentStore);

All the examples I have seen (including the ones in the sample project) had the index re-created every time the client is started which doesn’t seem right.

Also what is the general strategy? It seems like there’s the normal CRUD operation, then there’s administration commands such as the indexing one above. Do people just create a console app that does the admin and deploy/run that separately from the main app?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:39:49+00:00Added an answer on June 15, 2026 at 7:39 pm

    You don’t have to check for existence. The server will automatically compare the index definition you send and check to see if it already exists. If one exists with the same name and definition, then it is left alone. If one exists with the same name, but the definition has changed, then the old one is dropped and the new one is created.

    Usually one would create indexes in the same application, on application startup. For web apps that could be in global.asax, and for console/desktop apps it would just be the first part of the startup code.

    But sometimes that’s not possible, such as if you have many different databases, as multi-tenant applications often do. In those cases, you would create indexes when you create each tenant database, and you might need to update or create more indexes when you roll out a version upgrade.

    Also, I should mention that you can create indexes a few different ways.

    // scans the assembly for all indexes and creates them
    IndexCreation.CreateIndexes(assembly, documentStore);
    
    // scans a MEF catalog for all indexes and creates them
    IndexCreation.CreateIndexes(catalog, documentStore);
    
    // puts a single index the HARD way
    documentStore.DatabaseCommands.PutIndex(...);
    
    // puts a single index the easy way
    documentStore.ExecuteIndex(new YourIndexCreationTask());
    

    There are a few others, but you get the idea.

    And just to be thorough, if you really did want to check for index existance, you could use:

    documentStore.DatabaseCommands.GetIndex("YourIndex") != null
    

    But that will only check by name, not by definition. And you don’t need it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to check whether a given file exists in android sd card. I
I want to check whether a Tag (Case-Sensitive) exists in SQL Server 2005 table
I wrote this sample code to check whether integer or string index is better
I am using the following code to check whether an object exists or not
How to check whether specified index of view controllers in a tab bar is
I have @ColumnMetadata(index=1) ... @ColumnMetadata(index=2) ... @ColumnMetadata(index=3) ... And I have to check whether
I have URL like this http://example.com/index.php?id=10 . How can i check whether this URL
i have question. I want to check my ararylist of a specify index whether
How can I check whether a numpy array is empty or not? I used
Possible Duplicate: check whether internet connection is available with C# I just want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.