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 8559011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:56:26+00:00 2026-06-11T15:56:26+00:00

I need a very simple example of how to add a node to an

  • 0

I need a very simple example of how to add a node to an index with using Neo4JClient

In the following C# code I have created an index and an employee node.

Question:
In the following code, how can the node that was created be added to the index? The solutions should allow for the ability to search on EmployeeID or Name.

    class Program
    {
        static void Main(string[] args)
        {
            //Connect to Neo4J
            var graphClient = new GraphClient(new Uri(@"http://localhost:7474/db/data"));
            graphClient.Connect();

            //Create Index
            graphClient.CreateIndex("employee", new IndexConfiguration() { Provider = IndexProvider.lucene, Type = IndexType.exact }, IndexFor.Node);

            //Create an Employee node
            var employee = new Employee() { EmployeeID = "12345", Name = "Mike"};
            NodeReference employeeRef = graphClient.Create(employee);

            //Add the node that was just created to the Employee index.  

        }
        private class Employee
        {
            [JsonProperty("EmployeeID")]
            public string EmployeeID { get; set; }

            [JsonProperty("Name")]
            publi
  • 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-11T15:56:28+00:00Added an answer on June 11, 2026 at 3:56 pm

    Note: This answer applies to Neo4jClient 1.0.0.474. Make sure you have updated.

    When you create the node, you can supply the index entries:

    var employeeRef = graphClient.Create(
        employee,
        new IRelationshipAllowingParticipantNode<Employee>[0],
        new []
        {
            new IndexEntry("employee")
            {
                {"EmployeeID", 1234 },
                { "Name", "Mike" }
            }
        }
    );
    

    It looks a little verbose for a few reasons:

    1. You would almost never create a node without at least one relationship. The relationships would stack nicely in that second parameter.

    2. One node can end up in multiple indexes, and the keys and values don’t have to match the node.

    We would like to make this syntax nicer for the default scenario, but haven’t done it yet.

    When you update a node, you also need to supply new index entries then:

    graphClient.Update(employeeRef,
        e =>
        {
            e.Name = "Bob";
        },
        e => new[]
        {
            new IndexEntry("employee") { { "Name", e.Name } }
        });
    

    You can reindex a node without updating the node itself using graphClient.ReIndex.

    If you want to add an existing node to the index, without updating it, just use graphClient.ReIndex as well. (That method doesn’t make any assumptions about the node already being in the index.)

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

Sidebar

Related Questions

Very simple question. I need to perform a task when the user closes his
I have a very simple entry form. After a button is pressed, I need
I need a very simple and clear example of how to create an OCX
I realize this may be a very simple question but I need to know
I need a very simple menu which probably contains only one or two items:
I need a very simple jQuery to constantly scroll a list of text items
I need to complete a very simple application. We want to archive some Sharepoint
I need to use or stimulate a very simple session object inside my WCF
i developed a very simple vb.net application and i need a way for every
Sometimes you need to create a very simple single file application in Qt4. However

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.