Skip to content

Search Domain Graph Service. It's part of Jus Edge GraphQL.

Notifications You must be signed in to change notification settings

augustoscher/search-graphql

Repository files navigation

search-graphql

Search Domain Graph Service (DGS), corresponding to the search domain from Supergraph. Responsible of searching data in Elasticsearch cluster. It's builded with Apollo Federation v2 which is an open source architecture for building a distributed graph.

Requirements

It's possible to run application inside docker. But also, it's possible to run in your local machine. In this case, make sure that following apps are installed:

  • Node v16
  • Elasticsearch
  • Kibana

elastic:

docker network create elastic

docker run -d --name es01-test --net elastic -p 127.0.0.1:9200:9200 -p 127.0.0.1:9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.17.12

kibana:

docker run -d --name kib01-test --net elastic -p 127.0.0.1:5601:5601 -e "ELASTICSEARCH_HOSTS=http://es01-test:9200" docker.elastic.co/kibana/kibana:7.17.12

See the docs.

Running

To run application, just type:

yarn dev

Search GraphQL will be running on localhost:4001/graphql

Example

This query should fetch data from elasticsearch. Note that we don't have access of fields from other subgraphs.

query Search($artifact: String!, $q: String!) {
  search(artifact: $artifact, q: $q) {
    id
    documentId
    title
    body
    relatedDocument {
      documentId
      # mandatoryPrecedent isn't available in search subgaph
    }
  }
}

# variables
{
  "artifact": "JURISPRUDENCIA",
  "q": "danos morais"
}

About

Search Domain Graph Service. It's part of Jus Edge GraphQL.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published