I have a neo4j db with node_auto_indexing and relationship_auto_indexing at true and node_keys_indexable and relationship_keys_indexable with some keys.
I use neo4j 1.9.3 ans SDN 2.3.1.RELEASE
When I try to delete nodes using neoTemplate neo4jTemplate.delete(t); I get a read only index exception.
I try to disable auto index like that :
neo4jTemplate.getGraphDatabaseService().index().getNodeAutoIndexer().stopAutoIndexingProperty("myprop");
or
neo4jTemplate.getGraphDatabaseService().index().getNodeAutoIndexer().setEnabled(false);
don't work.
Any idea ?
Related
I try to create an index in Neo4j, but it seems like it is not working. I insert data with the following codes snippet.
create index on :`Person`(`name`)
create (_0:`Person` {`name`:"Andres"})
create (_1:`Person` {`name`:"Mark"})
create _0-[:`KNOWS`]->_1
The code here works fine. But when I try to fetch data with cypher command
START n=node:name(name= 'Bob')
RETURN n
I've got an error
Index `name` does not exist
Neo.ClientError.Schema.NoSuchIndex
But as you can see above, I declare an index name. What do I query wrong?
either you must use automatic index - http://docs.neo4j.org/chunked/milestone/auto-indexing.html - where you first specify in the neo4j config file which parameters would be indexed (than start/restart the server)
or when using manual indexing - http://docs.neo4j.org/chunked/milestone/indexing-add.html - you must include each new node into the index manualy like this:
MATCH (n:Person)
USING INDEX n:Person(name)
WHERE n.name = 'Bob'
RETURN n
view also neo4j cypher : unable to create and use an index
for testing and development reasons we reindex our data from a rails app by deleting an index and recreate with mapping and import existing documents.
But after recreating the index, elasticsearch returns other results than expected and before recreating. If we restart the elasticsearch instance, the results as expected.
This is how we recreate the index.
Tire.index indexname do
delete
create _mappings
import _objects
refresh
end
We also checked the search query directly via curl on elastic search, but we got not the expected result. After restarting the elastic search daemon, same query returns expected data.
What have to be done or what is expected of an elasticsearch instance to return correct data after recreating an index with the same name without restarting? We also tried creating new indexes with timestamp names and aliasing the index name to these index, but with same results.
thanks in advance
I followed the following post to test facebook friends of friends in Neo4j 2.0.1
http://blog.neo4j.org/2013/06/fun-with-facebook-in-neo4j_19.html
I am able to create the nodes successfully.. Auto Indexing is enabled
Here is the create node statement - create (n{name:'User 123', type:'Facebook'});
This works fine
When I create the relationships, I am getting this notification: "Nothing was created and No data Returned"
Here is the create Relationship statement
start n1=node:node_auto_index(name='User 123'),n2=node:node_auto_index(name='User XYZ') CREATE n1-[:IS_A_FRIEND_OF]->n2;
Any help is very much appreciated. I am new to neo4j and trying to get my hands dirty by learning some stuff.
Neo4j 2.0 has a new feature called schema indexes. For most use cases it's beneficial to use schema indexing instead of autoindexing.
For your example, I'd move the value of the type property to become a label.
First, create the index for property name based on label Facebook:
CREATE INDEX ON :Facebook(name)
The CREATE looks like:
CREATE (n:Facebook {name:'User 123'})
For creating the relationships use:
MATCH (n1:Facebook {name:'User 123'}),n2=(n2:Facebook {name:'User XYZ'})
CREATE n1-[:IS_A_FRIEND_OF]->n2
You might also look into Neo4j 2.0's new MERGE statement.
I've created an INDEX using cypher for my :Person label, but I cannot find any way of printing out a list of indexes or constraints available to my Neo4j system.
Is this something that is doable via Cypher?
As Eve pointed out, you can get labels by calling CALL.Labels(). To get indexes just do:
CALL db.indexes()
Also if you do CALL db. in your neo4j browser you will see all the functions available.
In browser you can use :schema or schema in the shell to print out all the indexes and constraints.
Nope. There's not even a way to list labels:
https://github.com/neo4j/neo4j/issues/1287
There are some REST calls for this, and the undocumented schema command in neo4j-shell is handy.
Edit: Update for 3.0 with the new stored procedures!
CALL db.labels()
(Applicable to neo4j version 2.3.1 or later)
To get indexes via REST use this:
curl http://localhost:7474/db/data/schema/index/
In the neo4j console you can run the :schema command to get all indexes & constraints.
I recently started neo4j with spring-data. So far all has been working well. But now I wanted to create my first simple query. So I added a Graph Repository with a query with
#Query(value = "MATCH (agent:Person) Where agent.name = 'Agent' RETURN agent;", elementClass = Agent.class).
This doesnt return any matches, even though the findAll() method of the repository returns all entities from the db.
Can anyone explain why this is happening?
Environment: neo4j 2.0.0M3 and spring-data 2.2.1
Spring Data Neo4j is not yet compatible with Neo4j 2.0. Thus you can't use labels in your queries.