GraphGrid Search Tutorial
GraphGrid Search leverages Elasticsearch (ES), a database for text storage and analytics engine. Search acts like a wrapper around ES. This allows Search to send and store graph data into ES. This also means that graph data will have all the advantages of ES searching features.
Here are some key terms to know before jumping in:
- Indexing: The process of putting data into ES so it becomes searchable.
- Searching: The process of retrieving data from ES through a query.
- ES Index: Logical namespce which holds documents (text data).
- ES Document: Searchable unit containing properties.
If we think about these ES features in terms of graph, ES index is akin to an ONgDB node label, and the ES document is akin to a ONgDB node.
Learn better by seeing it done? Follow along with our Search Basics video tutorial
Search Module Tutorial Overview
- Decide what we want to make searchable
- This step informs us how to use and design indexing/search queries.
- Indexing
- Generate and customize an index policy.
- Index nodes on the graph
- Event-driven indexing (Continuous Indexing).
- Search Queries
- Simple Query and Advanced Query
- Search Showme
We will be using the Movie Graph as our dataset. The Movie Graph is a built-in dataset example in ONgDB. If you haven't already done the Movie Database tutorial, run the query below and follow the instructions through step two to add the movie data to your graph. If you want to get the full benefit of this tutorial by working with the Dashboard, complete the Movie Database tutorial before proceeding.
:play movie graph
Design
The first step is to come up with features for Search. We can use these features to design an index policy. Before creating an index policy, we may ask:
- What do we want to search?
- What is the intended use?
- Who is the intended user?
- Where is this search response going?
Movies Search Desired features:
Feature 1: Person and Movie nodes should be searchable by their node properties. Feature 2: Searching the title of a movie ("matrix") should return the movie(s) along with all associated people (actors/directors)
After coming up with our desired features, we can design our index policy with specific features in mind.
Indexing
The purpose of indexing is to transform graph data into searchable text. The goal is to move information from ONgDB to ES. The index policy tells the module how to move that data. We achieve this operationally by using indexing endpoints and/or Continuous Indexing (CI .
Intro to Index Policy
The index policy is a JSON document that defines WHAT info in ONgDB to index and HOW to get that info. Core sections of the policy define schema (mapping) from a node to an ES document. Index policies follow a predefined structure (with the contents remaining specific to the graph), therefore these definitions can be applied to any graph.
For instance, the Search module is capabale of generating an index policy using all of our existing graph data. We can modify the index policy to maintain additional features such as: leveraging custom Geequel queries, defining index settings, creating static filters, and setting granular view requirements (role-based visibility).
Generated Index Policy
Generated index policies provide out-of-the-box searching for node properties. This feature generates a separate index for each desired node label, and creates a template that the user can customize. Generated index policies provide basic search functionality. One of these functions is the ability to search for a node's properties. By default, the generated policies define common properties to be indexed. You can generate a policy for all node labels or for a specific subset. When generating the index policy, Search assumes that data on the graph has consistent property typing.
Movie Database: Generate Custom Index Policy
Let's revisit Feature 1: Make Person
and Movie
nodes searchable by their node properties. From what we know about generated index policies, we can set the
policy schema for specific node labels and their properties. We can meet feature 1 by generating an index policy specifically for Person
and Movie
node labels.
Before running the generateIndexPolicy
endpoint the nodes and relationships are required to already be on the graph.
/generateCustomIndexPolicy/
curl --location --request POST "${API_BASE}/1.0/search/default/generateCustomIndexPolicy/default-search-index-policy" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--data-raw '{
"nodeTypes" : [
"Movie",
"Person"
]
}'
The response is the generated index policy. Click here to view the whole policy.
/saveIndexPolicy
Next we need to save the policy.
curl --location --request POST "${API_BASE}/1.0/search/default/saveIndexPolicy/default-search-index-policy" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--data-raw '{
"metadata": {
"description": "Generated index policy for node types: [Movie, Person].",
"displayName": "default-search-index-policy",
"createdAt": "2021-10-28T16:49:35.107Z",
"updatedAt": "2021-10-28T16:49:35.107Z",
"versions": [],
"state": "OFFLINE"
},
"caption": {
"priority": [
{
"property": "title"
},
{
"property": "name"
},
{
"property": "address"
},
{
"property": "phone"
},
{
"property": "grn"
}
]
},
"parameter": null,
"hardFilter": null,
"indexes": {
"movie": {
"indexData": {
"description": "Generated '\''movie'\'' index from the '\''Movie'\'' node type.",
"displayName": "movie",
"caption": {
"priority": []
}
},
"indexStrategies": {
"defaultBroker": {
"producer": "MATCH (n:`Movie`) WHERE n.grn IN {idList} WITH n AS `movie` RETURN `movie`",
"anchorLabel": "Movie",
"anchorId": "movie.grn",
"anchor": "movie",
"batchSize": "1000",
"parallel": "false",
"retries": "0",
"iterateList": "true",
"broker": "RABBITMQ"
},
"defaultPartial": {
"producer": "MATCH (n:`Movie`) WHERE n.updatedAt > n.lastSearchIndexedAt WITH n AS `movie` RETURN `movie`",
"anchorLabel": "Movie",
"anchorId": "movie.grn",
"anchor": "movie",
"batchSize": "1000",
"parallel": "false",
"retries": "0",
"iterateList": "true",
"broker": "DIRECT"
},
"defaultFull": {
"producer": "MATCH (n:`Movie`) WITH n AS `movie` RETURN `movie`",
"anchorLabel": "Movie",
"anchorId": "movie.grn",
"anchor": "movie",
"batchSize": "1000",
"parallel": "false",
"retries": "0",
"iterateList": "true",
"broker": "DIRECT"
}
},
"settings": {},
"mappings": null,
"schema": {
"createdAt": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"grn": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"lastSearchIndexedAt": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"tagline": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"title": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"released": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"updatedAt": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
}
},
"hardFilter": null,
"viewRequirements": {}
},
"person": {
"indexData": {
"description": "Generated '\''person'\'' index from the '\''Person'\'' node type.",
"displayName": "person",
"caption": {
"priority": []
}
},
"indexStrategies": {
"defaultBroker": {
"producer": "MATCH (n:`Person`) WHERE n.grn IN {idList} WITH n AS `person` RETURN `person`",
"anchorLabel": "Person",
"anchorId": "person.grn",
"anchor": "person",
"batchSize": "1000",
"parallel": "false",
"retries": "0",
"iterateList": "true",
"broker": "RABBITMQ"
},
"defaultPartial": {
"producer": "MATCH (n:`Person`) WHERE n.updatedAt > n.lastSearchIndexedAt WITH n AS `person` RETURN `person`",
"anchorLabel": "Person",
"anchorId": "person.grn",
"anchor": "person",
"batchSize": "1000",
"parallel": "false",
"retries": "0",
"iterateList": "true",
"broker": "DIRECT"
},
"defaultFull": {
"producer": "MATCH (n:`Person`) WITH n AS `person` RETURN `person`",
"anchorLabel": "Person",
"anchorId": "person.grn",
"anchor": "person",
"batchSize": "1000",
"parallel": "false",
"retries": "0",
"iterateList": "true",
"broker": "DIRECT"
}
},
"settings": {},
"mappings": null,
"schema": {
"createdAt": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"grn": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"lastSearchIndexedAt": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"born": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"name": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"updatedAt": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
}
},
"hardFilter": null,
"viewRequirements": {}
}
},
"globals": {},
"views": {}
}'
Using the Index Policy
With an index policy now saved, we can operationally index our data. An index policy by itself does nothing (it is just a file). You can think of the index policy like a set of instructions on how to index your data. Search and ES work together to follow those instructions after you (the user) tell them when to operate. There are two methods to invoke indexing: manually through indexing endpoints, or set up of event-driven indexing (Continuous Indexing).
Indexing Endpoint Options
In this first example to meet feature #1, we will index our movie data manually using indexing endpoints. Search uses broker-based indexing with the default broker RabbitMQ. Failed indexing messages are sent to a failure queue in the broker so there is no data loss.
There are two manual indexing options: full indexing and partial "catch-up" indexing. Full indexing uses the brokerIndexPolicyFull
endpoint (shown below) to
index all nodes. This endpoint can also be used to reindex all nodes. The second option, partial indexing uses the
brokerIndexPolicyPartial
endpoint. Partial indexing is also known as "catch-up"
indexing because it only indexes nodes that are stale.
/brokerIndexPolicyFull/
Using our generated index policy let's manually index our data by using the brokerIndexPolicyFull
endpoint. This will index all nodes on our graph.
curl --location --request POST "${API_BASE}/1.0/search/default/brokerIndexPolicyFull/default-search-index-policy/defaultBroker" \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Recap: Implementing Feature 1
Here's what we have done so far:
- We generated an index policy using
generateCustomIndexPolicy
- Then we saved that policy with
saveIndexPolicy
- Last we indexed our data with
brokerIndexPolicyFull
Searching
Our data is now searchable within our project! Try it out in the search bar. Searching for 'Keanu Reeves' will yield the result of 1
Person
node with data belonging to Keanu Reeves.
Click the arrow next to 'Keanu Reeves' to view the node properties.
Searching is also possible through the searchAll
endpoint. The term parameter(s) must be HTML URL encoded
(resource).
curl --location --request GET "${API_BASE}/1.0/search/default/default-search-index-policy/?query=%7B%22terms%22:%22keanu%22%7D" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Try searching some movies and people on your own!
Examples to try:
Search "keanu" OR "wach"
curl --location --request GET "${API_BASE}/1.0/search/default/default-search-index-policy/?query=%7B%22terms%22:%22keanu%20OR%20wach*%22%7D" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Search "matrix"
curl --location --request GET "${API_BASE}/1.0/search/default/default-search-index-policy/?query=%7B%22terms%22:%22matrix%22%7D" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}"
By searching for a Person
or Movie
node with either method we can observe that feature #1 has been met.
Index Policy Customization
GraphGrid Search index policies are highly customizable, giving fine-grained control over what gets indexed. Search leverages Geequel queries inside the index policy to retrieve targeted information about your data. Geequel queries in the index policy should be written from the perspective of the node being indexed, or the "anchor node".
Customizing the Index Policy
To implement feature #2 we need to update the index policy so that searching the title of a movie should return the movie(s) along with all associated people
(actors/directors). We can do this by including a list of movies each person is associated with under the Person
index. This can be done by adding two custom
index schema properties.
We need to add two schema properties under the Person
index. Since we want to return information based on movies that each person is associated with we can
name the two schema properties actedIn
and directed
. The custom Geequel tells Search to look for specific relationships between a Person
and Movie
node.
actedIn
looks for an optional match of a relationship ACTED_IN
between a Person
and Movie
node, and then collects that Movie
node's property "title".
The Geequel query in directed
functions similarly but instead of looking for the ACTED_IN
relationship, it looks for the relationship DIRECTED
between a
Person
and Movie
node.
The results of these custom Geequel queries are then indexed. This is an example of the two custom schema actedIn
and directed
that will be added under the
Person
index:
"schema": {
"actedIn": {
"schema": {
"generatorStrategies": {
"defaultBroker": "OPTIONAL MATCH (person)-[:ACTED_IN]->(m:Movie) WITH COLLECT(m.title)"
}
},
"searchQuery": {},
"viewRequirements": {}
},
"directed": {
"schema": {
"generatorStrategies": {
"defaultBroker": "OPTIONAL MATCH (person)-[:DIRECTED]->(m:Movie) WITH COLLECT(m.title)"
}
},
"searchQuery": {},
"viewRequirements": {}
},
We can update our index policy by finds the Person
index and replacing the "schema" property contents with the additions above.
Reference for index property formatting in policy.
Click here to view the whole policy with the added schema customizations of directed
and actedIn
.
Save Updated Customized Index Policy
This request includes the updated schema under the Person
index.
curl --location --request POST "${API_BASE}/1.0/search/default/saveIndexPolicy/default-search-index-policy" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--data-raw '{
"metadata": {
"description": "Generated index policy for node types: [Movie, Person]. Edited with custom properties.",
"displayName": "gg-test-index-policy",
"createdAt": "2021-10-18T14:56:46.95Z",
"updatedAt": "2021-10-18T14:57:16.446Z",
"versions": [],
"state": "OFFLINE"
},
"caption": {
"priority": [
{
"property": "title"
},
{
"property": "name"
},
{
"property": "address"
},
{
"property": "phone"
},
{
"property": "grn"
}
]
},
"parameter": null,
"hardFilter": null,
"indexes": {
"movie": {
"indexData": {
"description": "Generated '\''movie'\'' index from the '\''Movie'\'' node type.",
"displayName": "movie",
"caption": {
"priority": []
}
},
"indexStrategies": {
"defaultBroker": {
"producer": "MATCH (n:`Movie`) WHERE n.grn IN {idList} WITH n AS `movie` RETURN `movie`",
"anchorLabel": "Movie",
"anchorId": "movie.grn",
"anchor": "movie",
"batchSize": "1000",
"parallel": "false",
"retries": "0",
"iterateList": "true",
"broker": "RABBITMQ"
},
"defaultPartial": {
"producer": "MATCH (n:`Movie`) WHERE n.updatedAt > n.lastSearchIndexedAt WITH n AS `movie` RETURN `movie`",
"anchorLabel": "Movie",
"anchorId": "movie.grn",
"anchor": "movie",
"batchSize": "1000",
"parallel": "false",
"retries": "0",
"iterateList": "true",
"broker": "DIRECT"
},
"defaultFull": {
"producer": "MATCH (n:`Movie`) WITH n AS `movie` RETURN `movie`",
"anchorLabel": "Movie",
"anchorId": "movie.grn",
"anchor": "movie",
"batchSize": "1000",
"parallel": "false",
"retries": "0",
"iterateList": "true",
"broker": "DIRECT"
}
},
"settings": {},
"mappings": null,
"schema": {
"createdAt": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"grn": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"lastSearchIndexedAt": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"tagline": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"title": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"released": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"updatedAt": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
}
},
"hardFilter": null,
"viewRequirements": {}
},
"person": {
"indexData": {
"description": "Generated '\''person'\'' index from the '\''Person'\'' node type.",
"displayName": "person",
"caption": {
"priority": []
}
},
"indexStrategies": {
"defaultBroker": {
"producer": "MATCH (n:`Person`) WHERE n.grn IN {idList} WITH n AS `person` RETURN `person`",
"anchorLabel": "Person",
"anchorId": "person.grn",
"anchor": "person",
"batchSize": "1000",
"parallel": "false",
"retries": "0",
"iterateList": "true",
"broker": "RABBITMQ"
},
"defaultPartial": {
"producer": "MATCH (n:`Person`) WHERE n.updatedAt > n.lastSearchIndexedAt WITH n AS `person` RETURN `person`",
"anchorLabel": "Person",
"anchorId": "person.grn",
"anchor": "person",
"batchSize": "1000",
"parallel": "false",
"retries": "0",
"iterateList": "true",
"broker": "DIRECT"
},
"defaultFull": {
"producer": "MATCH (n:`Person`) WITH n AS `person` RETURN `person`",
"anchorLabel": "Person",
"anchorId": "person.grn",
"anchor": "person",
"batchSize": "1000",
"parallel": "false",
"retries": "0",
"iterateList": "true",
"broker": "DIRECT"
}
},
"settings": {},
"mappings": null,
"schema": {
"actedIn": {
"schema": {
"generatorStrategies": {
"defaultBroker": "OPTIONAL MATCH (person)-[:ACTED_IN]->(m:Movie) WITH COLLECT(m.title)"
}
},
"searchQuery": {},
"viewRequirements": {}
},
"directed": {
"schema": {
"generatorStrategies": {
"defaultBroker": "OPTIONAL MATCH (person)-[:DIRECTED]->(m:Movie) WITH COLLECT(m.title)"
}
},
"searchQuery": {},
"viewRequirements": {}
},
"createdAt": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"grn": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"lastSearchIndexedAt": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"born": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"name": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
},
"updatedAt": {
"schema": {
"generatorStrategies": {
"defaultBroker": "",
"defaultPartial": "",
"defaultFull": ""
}
},
"searchQuery": {},
"viewRequirements": {}
}
},
"hardFilter": null,
"viewRequirements": {}
}
},
"globals": {},
"views": {}
}'
Reindex to Update Search results
Next we need to reindex our data using the brokerIndexFull
request that will reindex all of our nodes:
curl --location --request POST "${API_BASE}/1.0/search/default/brokerIndexFull/default-search-index-policy/person/defaultBroker" \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Searching After Reindexing
Now test it out to find that feature 2 has been met! In the dashboard, search "Keanu Reeves." Search returns the directed
and actedin
properties associated
with Keanu.
Try searching a movie, you'll see that Search returns a list of people associated with the movie along with its usual results.
Requests to Try:
Simple "Keanu" Search
curl --location --request GET "${API_BASE}/1.0/search/default/default-search-index-policy/?query=%7B%22terms%22:%22keanu%22%7D" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Simple "Matrix" Search
curl --location --request GET "${API_BASE}/1.0/search/default/default-search-index-policy/?query=%7B%22terms%22:%22matrix%22%7D" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Simple "Matrix" Search (Returns Movies Only)
curl --location --request GET "${API_BASE}/1.0/search/default/default-search-index-policy/?query=%7B%22terms%22%3A%20%22matrix%22%2C%20%22indexes%22%3A%20%5B%22movie%22%5D%20%7D" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Simple "Directors of Matrix" Search
curl --location --request GET "${API_BASE}/1.0/search/default/default-search-index-policy/?query=%7B%22terms%22:%22directed:matrix%22%7D" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Recap: Implementing Feature 2
To implement feature 2 we:
- implemented
actedIn
anddirected
properties in thePerson
index using custom Geequel queries. - save our index policy changes with the
saveIndexPolicy
endpoint. - reindexed our data with the
brokerIndexPolicyFull
endpoint.
Continuous Indexing
Search's Continuous Indexing (CI) pipeline is capable of event-driven indexing for nodes that are added to the graph. For more information about how continuous indexing works, head here.
Continuous Indexing requires a message broker. In our example we're using the default broker of RabbitMQ.
CI Case Study Example
Before setting up CI, try updating Keanu's birth year in ONgDB. In the query bar of ONgDB (localhost:7474) run this query to update Keanu's birthday:
MATCH (p:Person {name: 'Keanu Reeves'})
SET p.born = 1500
RETURN p
After aging Keanu over 500 years, try searching for him.
curl --location --request GET "${API_BASE}/1.0/search/default/default-search-index-policy/?query=%7B%22terms%22:%22keanu%22%7D" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
...,
"data": {
"person": {
"documentCount": 1,
"documentData": [
...
"caption": "Keanu Reeves",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"directed": [],
"grn": "grn:gg:person:ubk3MOs7qBsbqQMVyxGegjmUVtODCzBgwIqFLXkYpecT",
"lastSearchIndexedAt": "2021-10-28T17:59:52+00:00",
"born": 1964,
"name": "Keanu Reeves",
"actedIn": [
"The Devil's Advocate",
"The Matrix Revolutions",
"The Matrix",
"The Matrix Reloaded",
"Johnny Mnemonic",
"The Replacements",
"Something's Gotta Give"
],
"updatedAt": "2021-10-28T15:30:27+00:00"
}
}
]
}
}
You'll see that the updated year isn't there! Even though we updated Keanu's node our search results still say he is born in 1964. Our search index is out of sync with our graph data!
Now let's apply the CI trigger:
curl --location --request POST "${API_BASE}/1.0/search/default/rabbitmqContinuousIndexingTrigger/default-search-index-policy/defaultBroker" \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Remember that with CI, only new or updated data on the graph becomes immediately searchable. This means we need to update Keanu's birth year again for this example to work.
Run this Geequel query in ONgDB to update Keanu's birth year:
MATCH (p:Person {name: 'Keanu Reeves'})
SET p.born = 2000
RETURN p
Then search Keanu again:
curl --location --request GET "${API_BASE}/1.0/search/default/default-search-index-policy/?query=%7B%22terms%22:%22keanu%22%7D" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}"
BOOM! The updated birth year is there.
{
...,
"data": {
"person": {
"documentCount": 1,
"documentData": [
...
"caption": "Keanu Reeves",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"directed": [],
"grn": "grn:gg:person:ubk3MOs7qBsbqQMVyxGegjmUVtODCzBgwIqFLXkYpecT",
"lastSearchIndexedAt": "2021-10-28T17:59:52+00:00",
"born": 2000,
"name": "Keanu Reeves",
"actedIn": [
"The Devil's Advocate",
"The Matrix Revolutions",
"The Matrix",
"The Matrix Reloaded",
"Johnny Mnemonic",
"The Replacements",
"Something's Gotta Give"
],
"updatedAt": "2021-10-28T15:30:27+00:00"
}
}
]
}
}
Notes on Continuous Indexing Use
To check that Continuous Indexing is running use this Geequel query in ONgDB:
CALL apoc.trigger.list
This will return a list of all the apoc triggers that are running. You should see the name of the index policy with continuousIndexing
hyphenated at the end of it.
To remove the indexing trigger run:
CALL apoc.trigger.remove("<trigger_name>")
Searching
In this section of the tutorial we will go over some information about searching to help you get the most out of Search.
Types of Search Module Queries
- Simple Query - Search using a query string (default)
- Entire query contained by single string
- Supports basic filtering, paging, fuzziness, and suggester features
- Great for throwaway queries
- "Simple" does not necessarily mean easy
- Advanced Query - Elasticsearch Query DSL
- Exposes subset of ES query language
- Full Search Module functionality
- Supports full sorting, filtering, paging, fuzziness, collapse and suggester features
- Search Showmes - Named parameterized search
Throughout this tutorial we have been using simple queries. Here is an example of an advanced query that uses parameterized search to return a list of movies that came out in the 90's sorted from earliest to latest:
Decoded Query Parameters:
{"query": {"queryType": "range", "property": "released", "gte": "1990", "lt": "2000"}, "sort": [{"sortType": "field", "property": "released"} ] }
curl --location --request GET "${API_BASE}/1.0/search/default/default-search-index-policy/?query=%7B%22query%22%3A%20%7B%22queryType%22%3A%20%22range%22%2C%20%22property%22%3A%20%22released%22%2C%20%22gte%22%3A%20%221990%22%2C%20%22lt%22%3A%20%222000%22%7D%2C%20%22sort%22%3A%20%5B%7B%22sortType%22%3A%20%22field%22%2C%20%22property%22%3A%20%22released%22%7D%20%5D%20%7D&mode=ADVANCED" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Response:
{
"report": {
"summary": {
"totalCount": 40,
"countDistribution": {
"movie": 40
}
}
},
"data": {
"movie": {
"documentCount": 40,
"maxScore": "NaN",
"documentData": [
{
"id": "grn:gg:movie:YTk4YSn3GcER9CCOfaYrvXahCldWf3b9SSmPovoBFOke",
"score": "NaN",
"caption": "Joe Versus the Volcano",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:YTk4YSn3GcER9CCOfaYrvXahCldWf3b9SSmPovoBFOke",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "A story of love, lava and burning desire.",
"title": "Joe Versus the Volcano",
"released": 1990,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:MOShvFHXUMDzBYcX9MNvT2RhTx1cNOdArORLXO2UgKCT",
"score": "NaN",
"caption": "Joe Versus the Volcano",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:MOShvFHXUMDzBYcX9MNvT2RhTx1cNOdArORLXO2UgKCT",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "A story of love, lava and burning desire.",
"title": "Joe Versus the Volcano",
"released": 1990,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:BXNMnIzhLi0QUxemVi2XlX7ze6OeTGGZtsoHhaRIl9NR",
"score": "NaN",
"caption": "A League of Their Own",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:BXNMnIzhLi0QUxemVi2XlX7ze6OeTGGZtsoHhaRIl9NR",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "Once in a lifetime you get a chance to do something different.",
"title": "A League of Their Own",
"released": 1992,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:RaIhRQxiDNtEAgKfwqBqWULVQTfZJaMHzwFWPaP9IHy6",
"score": "NaN",
"caption": "A Few Good Men",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:RaIhRQxiDNtEAgKfwqBqWULVQTfZJaMHzwFWPaP9IHy6",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "In the heart of the nation's capital, in a courthouse of the U.S. government, one man will stop at nothing to keep his honor, and one will stop at nothing to find the truth.",
"title": "A Few Good Men",
"released": 1992,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:PtDUxaA0a0CpVBb31MFUI21q2UYzzpSg4NMaw0CPZX7n",
"score": "NaN",
"caption": "A Few Good Men",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:PtDUxaA0a0CpVBb31MFUI21q2UYzzpSg4NMaw0CPZX7n",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "In the heart of the nation's capital, in a courthouse of the U.S. government, one man will stop at nothing to keep his honor, and one will stop at nothing to find the truth.",
"title": "A Few Good Men",
"released": 1992,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:qnespkjdDPhECKn6lRka9Sj4kXuIMA0WTq6dWDxZi7W6",
"score": "NaN",
"caption": "Hoffa",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:qnespkjdDPhECKn6lRka9Sj4kXuIMA0WTq6dWDxZi7W6",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "He didn't want law. He wanted justice.",
"title": "Hoffa",
"released": 1992,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:YT2oLHVLBkttVxSIEQcHUUEehvCB1gJDxjWp4a6Q3C6J",
"score": "NaN",
"caption": "Unforgiven",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:YT2oLHVLBkttVxSIEQcHUUEehvCB1gJDxjWp4a6Q3C6J",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "It's a hell of a thing, killing a man",
"title": "Unforgiven",
"released": 1992,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:iSUmt5nFPCdtzTckDNnbhZVR3HKU89W9Pdm1Adtyd1WC",
"score": "NaN",
"caption": "Hoffa",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:iSUmt5nFPCdtzTckDNnbhZVR3HKU89W9Pdm1Adtyd1WC",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "He didn't want law. He wanted justice.",
"title": "Hoffa",
"released": 1992,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:Qx4RhdUz3GcIx3zd1OLmVm5s2n7diXp5P0FVl6tCMsN3",
"score": "NaN",
"caption": "Unforgiven",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:Qx4RhdUz3GcIx3zd1OLmVm5s2n7diXp5P0FVl6tCMsN3",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "It's a hell of a thing, killing a man",
"title": "Unforgiven",
"released": 1992,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:O2NeR7XMrBthC9teKQzbGYCW8LTUQ26TZA11PjHrTCcJ",
"score": "NaN",
"caption": "A League of Their Own",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:O2NeR7XMrBthC9teKQzbGYCW8LTUQ26TZA11PjHrTCcJ",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "Once in a lifetime you get a chance to do something different.",
"title": "A League of Their Own",
"released": 1992,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:FOcic5YrpvBJ1NBNxsSAwyHWJ0qy5P9NaUXszXhHNAlY",
"score": "NaN",
"caption": "Sleepless in Seattle",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:FOcic5YrpvBJ1NBNxsSAwyHWJ0qy5P9NaUXszXhHNAlY",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "What if someone you never met, someone you never saw, someone you never knew was the only someone for you?",
"title": "Sleepless in Seattle",
"released": 1993,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:FeyXsr0U8lWLkIWSzZyHltnuooosKmh0r4y4tCKZogs6",
"score": "NaN",
"caption": "Sleepless in Seattle",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:FeyXsr0U8lWLkIWSzZyHltnuooosKmh0r4y4tCKZogs6",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "What if someone you never met, someone you never saw, someone you never knew was the only someone for you?",
"title": "Sleepless in Seattle",
"released": 1993,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:7eJmyrpiGAtC60JQDnKVg6F4E8Oyk3tFx24mtq2CGvcp",
"score": "NaN",
"caption": "Johnny Mnemonic",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:7eJmyrpiGAtC60JQDnKVg6F4E8Oyk3tFx24mtq2CGvcp",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "The hottest data on earth. In the coolest head in town",
"title": "Johnny Mnemonic",
"released": 1995,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:1OH55WYJkTKZe798BXNX38G0AMsWAABu7StK5c4cuJkG",
"score": "NaN",
"caption": "Apollo 13",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:1OH55WYJkTKZe798BXNX38G0AMsWAABu7StK5c4cuJkG",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "Houston, we have a problem.",
"title": "Apollo 13",
"released": 1995,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:6HoMSny5PviCUqnOm8VtHOxeoUKKjs05lh6kEeqUOtXl",
"score": "NaN",
"caption": "Johnny Mnemonic",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:6HoMSny5PviCUqnOm8VtHOxeoUKKjs05lh6kEeqUOtXl",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "The hottest data on earth. In the coolest head in town",
"title": "Johnny Mnemonic",
"released": 1995,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:M2Vo4je3YPdE2ZUx4nEmjvnvlV6M6GpJbGS8hh3V9kII",
"score": "NaN",
"caption": "Apollo 13",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:M2Vo4je3YPdE2ZUx4nEmjvnvlV6M6GpJbGS8hh3V9kII",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "Houston, we have a problem.",
"title": "Apollo 13",
"released": 1995,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:zDy2hI1TKyTeeK40ZrMGtfF56wV8h2Juim8fvdCqHEUg",
"score": "NaN",
"caption": "That Thing You Do",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:zDy2hI1TKyTeeK40ZrMGtfF56wV8h2Juim8fvdCqHEUg",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "In every life there comes a time when that thing you dream becomes that thing you do",
"title": "That Thing You Do",
"released": 1996,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:PhkTXtUxi9tIECQYNRyBC7VTH6GHr0VYZfqxv7OkCFwf",
"score": "NaN",
"caption": "The Birdcage",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:PhkTXtUxi9tIECQYNRyBC7VTH6GHr0VYZfqxv7OkCFwf",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "Come as you are",
"title": "The Birdcage",
"released": 1996,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:g6LKnnStLtNmeXRsQqgYRGvBbazmnFvRkIlr5uj5bJ5e",
"score": "NaN",
"caption": "That Thing You Do",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:g6LKnnStLtNmeXRsQqgYRGvBbazmnFvRkIlr5uj5bJ5e",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "In every life there comes a time when that thing you dream becomes that thing you do",
"title": "That Thing You Do",
"released": 1996,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:GoRw3XSA7D6X5hkUAdm2IpOyWLSNdBq0YQe2AQtSSz1O",
"score": "NaN",
"caption": "Twister",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:GoRw3XSA7D6X5hkUAdm2IpOyWLSNdBq0YQe2AQtSSz1O",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "Don't Breathe. Don't Look Back.",
"title": "Twister",
"released": 1996,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:5M0siG7CBC1oDvQv8O0cpiDI5aqKDFV0Z8ns0vI2EfI1",
"score": "NaN",
"caption": "Twister",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:5M0siG7CBC1oDvQv8O0cpiDI5aqKDFV0Z8ns0vI2EfI1",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "Don't Breathe. Don't Look Back.",
"title": "Twister",
"released": 1996,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:LCaGAV6SsGrxnnwLTMC0HcaocmxhbN8MVgLcjIYpfnMX",
"score": "NaN",
"caption": "The Birdcage",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:LCaGAV6SsGrxnnwLTMC0HcaocmxhbN8MVgLcjIYpfnMX",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "Come as you are",
"title": "The Birdcage",
"released": 1996,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:TphtU3MHdYImaTGn0EF5eTlegbaLYA69ev1R6N6BsP5j",
"score": "NaN",
"caption": "As Good as It Gets",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:TphtU3MHdYImaTGn0EF5eTlegbaLYA69ev1R6N6BsP5j",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "A comedy from the heart that goes for the throat.",
"title": "As Good as It Gets",
"released": 1997,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:ThRVH2c0S17CEa8wkljBJQmTKIXjxQXxpZyVpYVOf8jC",
"score": "NaN",
"caption": "The Devil's Advocate",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:ThRVH2c0S17CEa8wkljBJQmTKIXjxQXxpZyVpYVOf8jC",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "Evil has its winning ways",
"title": "The Devil's Advocate",
"released": 1997,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:Tkksw4u9mTbJR9O6UqDYvExgjEqmmLg5oVslsOvffJnh",
"score": "NaN",
"caption": "As Good as It Gets",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:Tkksw4u9mTbJR9O6UqDYvExgjEqmmLg5oVslsOvffJnh",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "A comedy from the heart that goes for the throat.",
"title": "As Good as It Gets",
"released": 1997,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:vRsY4Gfo8T0kjy72ILUXJJ7FpmmxJJ9qB8k1BCqpx8Dg",
"score": "NaN",
"caption": "The Devil's Advocate",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:vRsY4Gfo8T0kjy72ILUXJJ7FpmmxJJ9qB8k1BCqpx8Dg",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "Evil has its winning ways",
"title": "The Devil's Advocate",
"released": 1997,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:zGWOOpBeYXQujkhjEefbZLyzh628eV0yvqabSE3KC2bF",
"score": "NaN",
"caption": "You've Got Mail",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:zGWOOpBeYXQujkhjEefbZLyzh628eV0yvqabSE3KC2bF",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "At odds in life... in love on-line.",
"title": "You've Got Mail",
"released": 1998,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:UZYNT9zWTfUHjHErqUlmeYsSUSc3L43VFDW4zCNbK2NC",
"score": "NaN",
"caption": "When Harry Met Sally",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:UZYNT9zWTfUHjHErqUlmeYsSUSc3L43VFDW4zCNbK2NC",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "Can two friends sleep together and still love each other in the morning?",
"title": "When Harry Met Sally",
"released": 1998,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:7NiQn5fwklRmvfRrLN1HfogonDUCflw9N0sA1psG2LrY",
"score": "NaN",
"caption": "When Harry Met Sally",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:7NiQn5fwklRmvfRrLN1HfogonDUCflw9N0sA1psG2LrY",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "Can two friends sleep together and still love each other in the morning?",
"title": "When Harry Met Sally",
"released": 1998,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:gTce1j0nlttnNK43QH3uubNVIMPa2V20zTL117glgWzG",
"score": "NaN",
"caption": "What Dreams May Come",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:gTce1j0nlttnNK43QH3uubNVIMPa2V20zTL117glgWzG",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "After life there is more. The end is just the beginning.",
"title": "What Dreams May Come",
"released": 1998,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:nbuusuMhrljmWF3LUjxKZoouNSuDbGYirD083AHxAfYQ",
"score": "NaN",
"caption": "What Dreams May Come",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:nbuusuMhrljmWF3LUjxKZoouNSuDbGYirD083AHxAfYQ",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "After life there is more. The end is just the beginning.",
"title": "What Dreams May Come",
"released": 1998,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:Wg8FoVWZCALTGl4WYj6K4BO0BDCtta38KPMLtRwfwmrd",
"score": "NaN",
"caption": "You've Got Mail",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:Wg8FoVWZCALTGl4WYj6K4BO0BDCtta38KPMLtRwfwmrd",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "At odds in life... in love on-line.",
"title": "You've Got Mail",
"released": 1998,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:2mBJ5ZTwHFU2I6UOqP1TuSxhd9YwWsN8JrQvJRNzNbKt",
"score": "NaN",
"caption": "Snow Falling on Cedars",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:2mBJ5ZTwHFU2I6UOqP1TuSxhd9YwWsN8JrQvJRNzNbKt",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "First loves last. Forever.",
"title": "Snow Falling on Cedars",
"released": 1999,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:jqPlJ7ICkDPMLcE83m8oNvvUvnfkB75O5lBZnAx9wVjY",
"score": "NaN",
"caption": "Bicentennial Man",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:jqPlJ7ICkDPMLcE83m8oNvvUvnfkB75O5lBZnAx9wVjY",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "One robot's 200 year journey to become an ordinary man.",
"title": "Bicentennial Man",
"released": 1999,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:KvI3FDIcpvSCkf2o3z3VVgJvbYBGgkPLA4RhN3Sn1IWe",
"score": "NaN",
"caption": "Snow Falling on Cedars",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:KvI3FDIcpvSCkf2o3z3VVgJvbYBGgkPLA4RhN3Sn1IWe",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "First loves last. Forever.",
"title": "Snow Falling on Cedars",
"released": 1999,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:RGF7lwAS3OAq49yWsga1ojyWBCdbFMuWusOMbIcwTl6p",
"score": "NaN",
"caption": "The Matrix",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:RGF7lwAS3OAq49yWsga1ojyWBCdbFMuWusOMbIcwTl6p",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "Welcome to the Real World",
"title": "The Matrix",
"released": 1999,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:gv3bKJiFRwfq8IaRo03pNG2UKsgRkpksJ6pEljVrS10Z",
"score": "NaN",
"caption": "The Matrix",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:gv3bKJiFRwfq8IaRo03pNG2UKsgRkpksJ6pEljVrS10Z",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "Welcome to the Real World",
"title": "The Matrix",
"released": 1999,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:OhuGIMGYYXGY2aDX6ZT5QT2mP9tcKoExzILPjozUqsSu",
"score": "NaN",
"caption": "The Green Mile",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:OhuGIMGYYXGY2aDX6ZT5QT2mP9tcKoExzILPjozUqsSu",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "Walk a mile you'll never forget.",
"title": "The Green Mile",
"released": 1999,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
},
{
"id": "grn:gg:movie:U4nnJINHsjlI7KBVZghQlMQF6vrfroKD05Q9XBixk14k",
"score": "NaN",
"caption": "The Green Mile",
"source": {
"createdAt": "2021-10-27T19:00:51+00:00",
"grn": "grn:gg:movie:U4nnJINHsjlI7KBVZghQlMQF6vrfroKD05Q9XBixk14k",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "Walk a mile you'll never forget.",
"title": "The Green Mile",
"released": 1999,
"updatedAt": "2021-10-27T19:00:51+00:00"
}
},
{
"id": "grn:gg:movie:S5idJml1q1O9UgJE6YMfM6PVQ2fO7Hrno5yYOp1q0bds",
"score": "NaN",
"caption": "Bicentennial Man",
"source": {
"createdAt": "2021-10-28T15:30:27+00:00",
"grn": "grn:gg:movie:S5idJml1q1O9UgJE6YMfM6PVQ2fO7Hrno5yYOp1q0bds",
"lastSearchIndexedAt": "2021-10-28T17:10:36+00:00",
"tagline": "One robot's 200 year journey to become an ordinary man.",
"title": "Bicentennial Man",
"released": 1999,
"updatedAt": "2021-10-28T15:30:27+00:00"
}
}
]
}
},
"suggest": {},
"collapse": {},
"searchParams": {}
}
Re-indexing Search
Search indices are stored in Elasticsearch. Possible reasons for re-indexing could be duplicate search indices showing up in the search results.
To view all indices stored in Elasticsearch run the following command:
curl -XGET "localhost:9200/_cat/indices?v"
The response should look something like this:
(base) vannawinland@MBP-7GMD6T graphgrid-ai-light-2.0.0-SNAPSHOT 2 % curl -XGET "localhost:9200/_cat/indices?v"
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open manager HUGPFKgORMGmKsz5rwiWXw 5 1 1 0 10.6kb 10.6kb
yellow open person O_8MJ1WnRcmk6Noi4UuCdA 5 1 133 0 91.1kb 91.1kb
yellow open txresults20231211 RhVb_Px1TTagB2CSPGpc1w 5 1 492 0 622.4kb 622.4kb
yellow open graphgridversion C9jH8iTnTauO-VgU5zz-ug 5 1 1 0 6.2kb 6.2kb
yellow open logstash-2023.12.11 cPWmRzMxSfqGiEEFE8AQtQ 5 1 10000 0 3.5mb 3.5mb
yellow open corpus 8EoDE5qlSkWvHFHYf5cMlQ 5 1 1 0 5.7kb 5.7kb
yellow open org coZuX2Q4SXWlKIFOKZ4Nng 5 1 1 0 7.3kb 7.3kb
yellow open movie VMh9b5RTQe-ZztQqMtvU3g 5 1 38 0 52.5kb 52.5kb
yellow open txrequestquarantine yZOEjK1gTt2SteSx6QDxHQ 5 1 0 0 1.2kb 1.2kb
yellow open user GAqv7uvGRaOjY111z8We9A 5 1 1 0 12.2kb 12.2kb
yellow open txrequests20231211 aoDpuxmtS2WQHRua6TJ63g 5 1 492 26 498.6kb 498.6kb
yellow open graphgridprojectversion ZSyKTdbLQmmL6vcph_Q8qA 5 1 5 0 19.3kb 19.3kb
yellow open graphgridresource 0Kv1lkYLRSOmKjbkpKWcNg 5 1 175 0 101.3kb 101.3kb
yellow open apm-6.8.15-2023.12.11 twvvHjTvQku0TV-ZI37fGA 1 1 6384 0 2mb 2mb
yellow open resource 8e4-_6XbTdm1FFbJrnmxTQ 5 1 175 0 150kb 150kb
To delete a specific index from Elasticsearch, run the following request: curl -XDELETE "localhost:9200/{{name_of_index_to_be_deleted}}"
For example, if you wanted to delete all the person indices:
curl -XDELETE "localhost:9200/person"
You can then re-index by running the broker index partial request:
curl --location '${API_BASE}/1.0/search/default/brokerIndexListPartial/default-search-index-policy/defaultBroker' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--data '{
"indexes": [
"person"
]
}'