Installation

pip install graphene-elastic

Quick start

Clone the repository

git clone git@github.com:barseghyanartur/graphene-elastic.git && cd graphene-elastic

Start Elasticsearch

docker-compose up elasticsearch

Install requirements

pip install -r requirements.txt

Populate dummy data

./scripts/populate_elasticsearch_data.sh

Run the test server

./scripts/run_flask.sh

Open the graphiql client the browser

http://127.0.0.1:8001/graphql

Make some experiments

{
  allPostDocuments {
    pageInfo {
      startCursor
      endCursor
      hasNextPage
      hasPreviousPage
    }
    edges {
      cursor
      node {
        category
        title
        content
        numViews
      }
    }
  }
}

Run tests

./runtests.py

Search

Search in all fields:

query {
  allPostDocuments(
    search:{query:"Release Box"}
  ) {
    edges {
      node {
        category
        title
        content
      }
    }
  }
}

Search in specific fields:

query {
  allPostDocuments(
    search:{
        title:{value:"Release", boost:2},
        content:{value:"Box"}
    }
  ) {
    edges {
      node {
        category
        title
        content
      }
    }
  }
}

keywords: python