Skip to content

Releases: block/elasticgraph

v1.1.0

23 Jan 01:44

Choose a tag to compare

ElasticGraph v1.1.0 has been released! This release includes new gems for data warehouse integration, Ruby 4.0 support, significant performance optimizations, and bug fixes.

New Features

Data Warehouse Integration

Two new gems have been added to support data warehouse integration:

elasticgraph-warehouse: An extension that generates Data Warehouse table configurations from ElasticGraph schemas. This enables seamless integration with data warehouse systems like Apache Hive, AWS Athena, and similar SQL-based analytical platforms by automatically generating DDL and configuration files. After adding it to an ElasticGraph project, run bundle exec rake schema_artifacts:dump and a data_warehouse.yaml file will be generated containing SQL CREATE TABLE statements for each indexed type.

elasticgraph-warehouse_lambda: An AWS Lambda integration for warehouse data export. This gem enables export of indexing operations to S3 as gzipped JSONL files, with features like deterministic S3 keys with versioning, date partitioning, and UUIDs.

Ruby 4.0 Support

ElasticGraph now supports Ruby 4.0 (and uses Bundler 4.0).

JSON Schema Improvements

  • Generated JSON schemas now include field description fields, useful for documentation and code generation tools (#875)
  • JSON schema strictness can now be configured with allow_omitted_fields and allow_extra_fields options (#876)

Query Registry Improvements

  • Added extension_data to QueryDetailsTracker enabling GraphQL extensions to log additional data. The query registry uses this to log query_registration_status (#981)
  • Improved operation name handling by preferring selected_operation_name over operation_name, which is safer when a query has only one operation (#986)

Version Validation for Schema Artifacts

ElasticGraph now validates that the schema artifacts version matches the runtime version, raising an error on mismatch (#874)

Upgrade notes

If you use sourced_from in your schema definition, you must now configure your index with i.has_had_multiple_sources! within the t.index block. This ensures the elasticgraph-graphql query engine correctly filters on multi-source documents while avoiding some additional queries ElasticGraph used to make for this case. Once added, this configuration should be retained even if sourced_from fields are later removed, as it remains true forever that the index has had multiple sources.

What's Changed

New Features

Performance Optimizations

  • Implement grouping_missing_value_placeholder for optimized aggregation subaggregations. Previously, when grouping by multiple fields, ElasticGraph created exponentially many subaggregations to handle missing values. The new approach achieves linear scaling, significantly improving performance for queries that group by many fields. by @mmarston and @myronmarston in #890, #893, #894, #895, #903
  • Omit Elasticsearch API calls on indexer boot by @ayousufi in #857
  • Optimize searches_could_hit_incomplete_docs? to avoid datastore queries by @ayousufi in #911

Bug Fixes

  • Resolve range query filter bugs where filters were being overridden due to deep_merge and Ruby hash merging by @ayousufi in #912
  • Fix site:doctest by @jwils in #918

Other Improvements

Dependency Upgrades

The datastore versions we build against have been upgraded:

  • Elasticsearch: 9.1 -> 9.2.0 (#896, #980)
  • OpenSearch: 3.2.x -> 3.3.0 (#896, #980)

The following Ruby gems have been upgraded:

Read more

v1.0.3.rc1

23 Jan 00:39

Choose a tag to compare

v1.0.3.rc1 Pre-release
Pre-release

What's Changed

  • Release v1.0.2 by @github-actions[bot] in #848
  • build(deps): bump the most-gems group with 6 updates by @dependabot[bot] in #852
  • Use github app for update-gem-version-artifacts workflow by @finn-block in #855
  • build(deps-dev): bump @tailwindcss/typography from 0.5.16 to 0.5.18 in /config/site in the npm group by @dependabot[bot] in #851
  • build(deps): bump the github-actions group with 12 updates by @dependabot[bot] in #861
  • build(deps-dev): bump @tailwindcss/typography from 0.5.18 to 0.5.19 in /config/site in the npm group by @dependabot[bot] in #860
  • build(deps): update mcp[cli] requirement from ~=1.14.0 to ~=1.15.0 in /ai_tools/elasticgraph-mcp-server in the pip group by @dependabot[bot] in #859
  • build(deps-dev): bump tailwindcss from 4.1.13 to 4.1.14 in /config/site in the npm group by @dependabot[bot] in #864
  • Bump rack from 3.2.1 to 3.2.2 by @nicolewoch in #867
  • build(deps): bump the pip group across 1 directory with 2 updates by @dependabot[bot] in #870
  • build(deps): bump bigdecimal from 3.2.3 to 3.3.1 in /config/release in the release-gems group by @dependabot[bot] in #869
  • Improve error messages to include 'bundle exec' prefix for rake commands by @mayurvaishnav in #872
  • Support descriptions in generated JSON schemas by @mayurvaishnav in #875
  • Allow omitted fields extra fields by @ciaran51 in #876
  • Add script/lint and document it in CONTRIBUTING.md. by @myronmarston in #877
  • build(deps-dev): bump tailwindcss from 4.1.14 to 4.1.15 in /config/site in the npm group by @dependabot[bot] in #878
  • build(deps): update mcp[cli] requirement from ~=1.17.0 to ~=1.18.0 in /ai_tools/elasticgraph-mcp-server in the pip group by @dependabot[bot] in #879
  • When loading artifacts check dumped elasticgraph version by @coreyosity in #874
  • chore: work around a certs issue that some contributors have reported. by @myronmarston in #881
  • Refactor: instantiate Results and SchemaArtifactManager from the Factory. by @myronmarston in #883
  • build(deps-dev): bump tailwindcss from 4.1.15 to 4.1.16 in /config/site in the npm group by @dependabot[bot] in #887
  • build(deps): update mcp[cli] requirement from ~=1.18.0 to ~=1.19.0 in /ai_tools/elasticgraph-mcp-server in the pip group by @dependabot[bot] in #886
  • Create new empty gem for the warehouse. by @jwils in #884
  • Add base type extensions for the warehouse. by @jwils in #885
  • Phase 1: Add grouping_missing_value_placeholder runtime metadata by @mmarston in #890
  • Phase 2: Infer grouping_missing_value_placeholder based on mapping_type by @mmarston in #893
  • Phase 3: Wire up grouping_missing_value_placeholder in GraphQL layer by @mmarston in #894
  • build(deps): bump the github-actions group with 6 updates by @dependabot[bot] in #897
  • Make it easy to use claude in this codebase. by @myronmarston in #902
  • build(deps): update mcp[cli] requirement from ~=1.19.0 to ~=1.20.0 in /ai_tools/elasticgraph-mcp-server in the pip group by @dependabot[bot] in #900
  • Check coercion adapter when inferring int placeholder. by @myronmarston in #903
  • build(deps): bump rake from 13.3.0 to 13.3.1 in /config/release in the release-gems group by @dependabot[bot] in #898
  • Phase 4: Use grouping_missing_value_placeholder in aggregation logic by @mmarston in #895
  • Improve script/update_gem_constraints: support pinned versions. by @myronmarston in #905
  • build(deps): bump the most-gems group across 1 directory with 35 updates by @dependabot[bot] in #906
  • Build against Elasticsearch 9.2.0 and OpenSearch 3.3.0. by @myronmarston in #896
  • Omit Elasticsearch API calls on indexer boot by @ayousufi in #857
  • build(deps): bump the most-gems group with 3 updates by @dependabot[bot] in #909
  • build(deps-dev): bump tailwindcss from 4.1.16 to 4.1.17 in /config/site in the npm group by @dependabot[bot] in #908
  • build(deps): bump the pip group in /ai_tools/elasticgraph-mcp-server with 4 updates by @dependabot[bot] in #907
  • Remove 'zachbutler-squareup' from CODEOWNERS by @zachbutler-squareup in #915
  • build(deps): bump the most-gems group with 7 updates by @dependabot[bot] in #914
  • Add union type support to the warehouse table by @jwils in #916
  • Optimize searches_could_hit_incomplete_docs? to avoid datastore queries by @ayousufi in #911
  • Fix site:doctest by @jwils in #918
  • Upgrade GraphQL gem from 2.5.11 to 2.5.14. by @myronmarston in #919
  • Make it easier for extensions to add schema artifacts. by @myronmarston in #920
  • build(deps-dev): bump standard from 1.51.1 to 1.52.0 by @dependabot[bot] in #924
  • build(deps): bump the most-gems group with 12 updates by @dependabot[bot] in #923
  • build(deps): bump the pip group in /ai_tools/elasticgraph-mcp-server with 2 updates by @dependabot[bot] in #922
  • Remove an old commented-out line of code. by @myronmarston in #921
  • Refactor SchemaArtifactManager to be friendlier to extension. by @myronmarston in #927
  • Drop work around for OpenSearch < 2.13. by @myronmarston in #926
  • Resolve range query filter bugs by @ayousufi in #912
  • Fix grammar: "x when for y" doesn't read correctly. by @myronmarston in #928
  • build(deps): bump yard from 0.9.37 to 0.9.38 in /config/release in the release-gems group by @dependabot[bot] in #929
  • build(deps): update mcp[cli] requirement from ~=1.22.0 to ~=1.23.2 in /ai_tools/elasticgraph-mcp-server in the pip group by @dependabot[bot] in #930
  • Pin aws-sdk-cloudwatch to 1.125.0 to fix CI test failures. by @myronmarston in #939
  • build(deps): bump graphql from 2.5.14 to 2.5.16 by @dependabot[bot] in #936
  • build(deps): bump json_schemer from 2.4.0 to 2.5.0 by @dependabot[bot] in #935
  • build(deps-dev): bump tailwindcss from 4.1.17 to 4.1.18 in /config/site in the npm group by @dependabot[bot] in #934
  • build(deps): update mcp[cli] requirement from ~=1.23.2 to ~=1.24.0 in /ai_tools/elasticgraph-mcp-server in the pip group by @dependabot[bot] in #937
  • build(deps): bump rack from 3.2.2 to 3.2.4 by @dependabot[bot] in #933
  • build(deps): bump json_schemer from 2.4.0 to 2.5.0 in /config/release in the release-gems group by @dependabot[bot] in #932
  • Upgrade YARD to 0.9.38. by @myronmarston in #941
  • build(deps): bump aws-sdk-s3 from 1.205.0 to 1.208.0 by @dependabot[bot] in #943
  • Use name_in_index for warehouse column type generation. by @jwils in #945
  • Add WarehouseTable model and warehouse_table type method. by @jwils in #946
  • Normalizes DateTime values to consistent 3-digit millisecond precision by @jwils in #944
  • Instantiate Indexing::Index from the schema def factory. by @myronmarston in #953
  • build(deps): bump bigdecimal from 3.3.1 to 4.0.1 in /config/release in the release-gems group by @dependabot[bot] in #950
  • build(deps): bump the most-gems group across 1 directory with 25 updates by @dependabot[bot] in #952
  • build(deps): update mcp[cli] requirement from ~=1.24.0 to ~=1.25.0 in /ai_tools/elasticgraph-mcp-server in the pip group by @Depe...
Read more

v1.0.2

19 Sep 17:33

Choose a tag to compare

New Features

Documentation Changes

Internal Changes

Dependency Changes

  • build(deps-dev): bump tailwindcss from 4.1.11 to 4.1.12 in /config/site in the npm group by @dependabot[bot] in #801
  • build(deps): update mcp[cli] requirement from ~=1.12.3 to ~=1.13.0 in /ai_tools/elasticgraph-mcp-server in the pip group by @dependabot[bot] in #802
  • Upgrade codespell to 2.4.1 on CI. by @myronmarston in #806
  • build(deps): bump the most-gems group with 12 updates by @dependabot[bot] in #822
  • build(deps): bump aws-sdk-sqs from 1.100.0 to 1.101.0 in the most-gems group by @dependabot[bot] in #823
  • build(deps): bump the most-gems group with 7 updates by @dependabot[bot] in #829
  • build(deps): bump the most-gems group with 12 updates by @dependabot[bot] in #830
  • build(deps): bump rack from 3.2.0 to 3.2.1 by @dependabot[bot] in #837
  • build(deps): bump elasticsearch from 9.1.1 to 9.1.2 by @dependabot[bot] in #836
  • build(deps-dev): bump rbs from 3.9.4 to 3.9.5 by @dependabot[bot] in #834
  • build(deps): bump the most-gems group with 11 updates by @dependabot[bot] in #835
  • build(deps): update pytest-cov requirement from ~=6.2.1 to ~=6.3.0 in /ai_tools/elasticgraph-mcp-server in the pip group by @dependabot[bot] in #833
  • build(deps-dev): bump tailwindcss from 4.1.12 to 4.1.13 in /config/site in the npm group by @dependabot[bot] in #832
  • build(deps): bump bigdecimal from 3.2.2 to 3.2.3 in /config/release in the release-gems group by @dependabot[bot] in #831
  • build(deps): bump the most-gems group across 1 directory with 10 updates by @dependabot[bot] in #838
  • Update gem artifacts. by @myronmarston in #839
  • Lock graphql gem to 2.5.11 to resolve elasticgraph-apollo test failure introduced in 2.5.12 by @bsorbo in #842
  • build(deps): bump the release-gems group in /config/release with 2 updates by @dependabot[bot] in #846
  • build(deps): bump the pip group in /ai_tools/elasticgraph-mcp-server with 4 updates by @dependabot[bot] in #847
  • build(deps): bump the most-gems group with 10 updates by @dependabot[bot] in #843
  • build(deps-dev): bump standard from 1.50.0 to 1.51.1 by @dependabot[bot] in #844

New Contributors

Full Changelog: v1.0.1...v1.0.2

v1.0.1

18 Aug 22:32

Choose a tag to compare

ElasticGraph v1.0.1 has been released! This release includes an improved configuration system and a bug fixes.

New Features

New JSON Schemas for Configuration

We've added JSON schema validation to the configuration system. This provides improved defaulting and validation of YAML settings files and is the basis for several new documentation resources:

Upgrade notes

The elasticgraph-json_schema gem has been merged into the elasticgraph-support gem. If you've been listing elasticgraph-json_schema in your Gemfile, you'll need to remove it.

What's Changed

New Features

Bug Fixes

  • fix: Resolved an issue for numeric derived fields that contained values both within Integer and Long ranges by @ayousufi in #795

Other Improvements

New Contributors


Full Changelog: v1.0.0...v1.0.1

v1.0.0

04 Aug 22:59

Choose a tag to compare

ElasticGraph v1.0.0 has been released! This marks a significant milestone in the maturity of ElasticGraph.

This release includes a number of new features and the removal of several long-deprecated features.

New Features

Substring Filtering

ElasticGraph 1.0.0 offers a couple new filtering predicates for string fields.

The contains predicate provides substring filtering:

query AverageSongLengthForYouOrEye {
  artistAggregations {
    nodes {
      subAggregations {
        albums {
          nodes {
            subAggregations {
              tracks(filter: {
                name: {
                  contains: {
                    anySubstringOf: ["you", "eye"]
                    ignoreCase: true
                  }
                }
              }) {
                nodes {
                  groupedBy {
                    name
                  }

                  aggregatedValues {
                    lengthInSeconds {
                      approximateAvg
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

The startsWith predicate provides prefix filtering:

query ArtistsPrefixedWithThe {
  artists(filter: {
    name: {
      startsWith: {
        anyPrefixOf: ["The "]
      }
    }
  }) {
    edges {
      node {
        name
      }
    }
  }
}

Search Highlighting

When searching through textual data it can be very useful to know where matches occurred in the returned documents. For example, to power a "global search" box that lets users search across all string/text fields, you could use a query like this:

query GlobalSearch(
  $query: String = "Rock" # an example search term; replace with whatever you want
) {
  artists(filter: {
    anyOf: [
      {albums: {anySatisfy: {name: {contains: {anySubstringOf: [$query]}}}}}
      {albums: {anySatisfy: {tracks: {anySatisfy: {name: {contains: {anySubstringOf: [$query]}}}}}}}
      {bio: {homeCountry: {equalToAnyOf: [$query]}}}
      {bio: {description: {matchesQuery: {query: $query}}}}
      {name: {contains: {anySubstringOf: [$query]}}}
      {tours: {anySatisfy: {name: {contains: {anySubstringOf: [$query]}}}}}
    ]
  }) {
    edges {
      node {
        name
      }

      highlights {
        albums {
          name
          tracks {
            name
          }
        }

        bio {
          homeCountry
          description
        }

        name

        tours {
          name
        }
      }
    }
  }
}

ElasticGraph also offers allHighlights as an alternative to highlights which allows the query to be simplified a bit:

query GlobalSearchV2(
  $query: String = "Rock" # an example search term; replace with whatever you want
) {
  artists(filter: {
    anyOf: [
      {albums: {anySatisfy: {name: {contains: {anySubstringOf: [$query]}}}}}
      {albums: {anySatisfy: {tracks: {anySatisfy: {name: {contains: {anySubstringOf: [$query]}}}}}}}
      {bio: {homeCountry: {equalToAnyOf: [$query]}}}
      {bio: {description: {matchesQuery: {query: $query}}}}
      {name: {contains: {anySubstringOf: [$query]}}}
      {tours: {anySatisfy: {name: {contains: {anySubstringOf: [$query]}}}}}
    ]
  }) {
    edges {
      node {
        name
      }

      allHighlights {
        path
        snippets
      }
    }
  }
}

Rather than providing the nested structure with named fields provided by highlights, this provides the highlights as a flat
list of SearchHighlight objects, each of which has a path indicating the matching field.

Bundled GraphiQL UI

Before ElasticGraph 1.0.0, ElasticGraph provided a version of GraphiQL that dependened on a CDN (https://esm.sh/) to work. This generally worked fine, but it relied on an active internet connection to work, and ElasticGraph's GraphiQL UI would stop working if the CDN had some downtime.

ElasticGraph 1.0.0 now bundles all GraphiQL assets in a new elasticgraph-graphiql gem. As part of this, we've upgraded GraphiQL from 4.0.0 to 5.2.0.

Support for Elasticsearch 9.1 and OpenSearch 3.0/3.1

ElasticGraph 1.0.0 supports these recently released versions of Elasticsearch and OpenSearch.

Upgrade notes

This release drops support for some legacy features which provided backwards compatibility for old ElasticGraph projects. The upgrade should be quite easy for most existing projects. Here's a detailed checklist.

Verify Ruby Compatibility

This release drops support for Ruby 3.2 and 3.3, requiring Ruby 3.4, which has been supported since ElasticGraph v0.19.1.0. Confirm you're using Ruby 3.4.x on CI and in production before proceeding.

Verify OpenSearch Compatibility

This release drops support for OpenSearch 2.7 to 2.18, requiring 2.19 or greater. If you're using OpenSearch in production, confirm it's version is 2.19 or greater before proceeding.

Remove nested_relationship_resolver_mode from GraphQL configuration

This option was added in ElasticGraph 0.19.2.0 when we were first rolling out the nested relationship performance optimization, so that existing projects could carefully roll that out if desired. Verify that nested_relationship_resolver_mode has been removed from your project's settings YAML files.

Verify Index Compatibility

ElasticGraph v0.9 featured a large change to how indexing worked. As part of that change, ElasticGraph began using a Painless update script for all indexing. All ElasticGraph projects bootstrapped since that time automatically use the new Painless script, but projects that started before that time may still use the old approach. Unfortunately, an index that has been written to using the old approach cannot safely be written to using the Painless update script. A backwards-compatibility mode has been kept around in ElasticGraph since that time, but ElasticGraph 1.0.0 removes it.

If your project predates ElasticGraph v0.9, you'll need to confirm your indices are ready for ElasticGraph 1.0.0 before proceeding:

  • Verify that use_updates_for_indexing: false is not configured in any of your settings YAML files.
    • If use_updates_for_indexing: true is configured, you'll need to remove that configuration. Indexing always uses updates, and no configuration is supported to control it.
  • Verify that all indexed documents have a __versions field. To check, use the dev tools console in Elasticsearch Kibana or OpenSearch dashboards and run one of the following queries:

For OpenSearch:

POST /*,-excluded_index1,-excluded_index2/_search
{
  "derived": {
    "has_versions": {
      "type": "boolean",
      "script": {
        "source": """
          def s = params._source;
          if (s == null) { emit(false); }
          else { emit(s.containsKey("__versions")); }
        """
      }
    }
  },
  "query": {
    "term": { "has_versions": false }
  },
  "_source": true,
  "size": 10
}

For Elasticsearch:

POST /*,-excluded_index1,-excluded_index2/_search
{
  "runtime_mappings": {
    "has_versions": {
      "type": "boolean",
      "script": {
        "source": """
          def s = params._source;
          if (s == null) { emit(false); }
          else { emit(s.containsKey("__versions")); }
        """
      }
    }
  },
  "query": {
    "term": { "has_versions": false }
  },
  "_source": true,
  "size": 10
}

Note

You'll probably have to customize the query above to exclude specific indices that do not have __versions (and should not have __versions) by replacing -excluded_index1,-excluded_index2. In general, any index that is not written to by ElasticGraph should be excluded. These may have names like .kibana_*, .plugins-*, .security* or .opendistro*. In addition, any ElasticGraph derived index (populated using the derive_indexed_type_fields schema definition API) wil not have __versions and should be excluded.

If the query returns no results (after you've excluded the appropriate indices), then you can safely proceed. If results are returned on any non-derived ElasticGraph indices, you're not ready to upgrade to 1.0.0. You'll first need to run a backfill into a fresh index using ElasticGraph 0.19.x with use_updates_for_indexing: true (or with that option omitted to use the default of true). Reach out in the #elasticgraph channel on the Block Open Source Discord server if you need help.

Remove legacy_grouping_schema: true

ElasticGraph 0.17.1.0 introduced an improved Date/Time grouping API. The GraphQL schema for it, while strictly better, was a breaking change for existing GraphQL clients. A backwards-compatibility mode was provided to allow existing ElasticGraph projects to easily upgrade:

t.field "startedAt", "DateTime", legacy_grouping_schema: true

The legacy_grouping_schema option has been removed from ElasticGraph v1.0.0, and if your schema definition uses it, you'll have to go through a multi-step migration process before you can upgrade.

  1. Introduce an aliased field. The field should use an alternate name (e.g. with a Legacy suffix), be graphql_only, and specify a name_in_index of the original field so that it's backed by the existing field in the index:
diff --git a/config/schema/artists.rb b/config/schema/artists.rb
index dbeeef4..b633d7b 100644
---...
Read more

v1.0.0.rc4

04 Aug 17:45

Choose a tag to compare

v1.0.0.rc4 Pre-release
Pre-release

What's Changed

New Contributors

Full Changelog: v1.0.0.rc3...v1.0.0.rc4

v1.0.0.rc3

10 Jul 21:41

Choose a tag to compare

v1.0.0.rc3 Pre-release
Pre-release

What's Changed

Full Changelog: v1.0.0.rc2...v1.0.0.rc3

v1.0.0.rc2

09 Jul 18:09

Choose a tag to compare

v1.0.0.rc2 Pre-release
Pre-release

What's Changed

Full Changelog: v1.0.0.rc1...v1.0.0.rc2

v0.19.3.0

20 Jun 16:30

Choose a tag to compare

ElasticGraph v0.19.3.0 has been released! This release includes a couple of new features, some bug fixes, and a minor breaking change.

New Feature: Field-level Custom Resolver Arguments

We added a custom GraphQL resolver API in ElasticGraph v0.19.2.0. That release allowed the same resolver class to be used with different parameters by registering it multiple times:

require(require_path = "roll_dice_resolver")
schema.register_graphql_resolver :roll_2_dice,
  RollDiceResolver,
  defined_at: require_path,
  number_of_dice: 2

schema.register_graphql_resolver :roll_3_dice,
  RollDiceResolver,
  defined_at: require_path,
  number_of_dice: 3

schema.on_root_query_type do |t|
  t.field "roll2Dice", "Int" do |f|
    f.resolve_with :roll_2_dice
  end

  t.field "roll3Dice", "Int" do |f|
    f.resolve_with :roll_3_dice
  end
end

ElasticGraph v0.19.3.0 allows you to provide these parameters at the field level when configuring a field to use a resolver:

require(require_path = "roll_dice_resolver")
schema.register_graphql_resolver :roll_dice,
  RollDiceResolver,
  defined_at: require_path

schema.on_root_query_type do |t|
  t.field "roll2Dice", "Int" do |f|
    f.resolve_with :roll_dice, number_of_dice: 2
  end

  t.field "roll3Dice", "Int" do |f|
    f.resolve_with :roll_dice, number_of_dice: 3
  end
end

Improved Apollo Federation Support

Apollo Federation provides a powerful way to combine multiple subgraphs into a single supergraph. ElasticGraph has shipped with the elasticgraph-apollo extension for a long time, which makes any ElasticGraph project plug into an Apollo supergraph as a subgraph.

However, ElasticGraph schemas haven't always lined up with Apollo federation idioms. To expose a reference to an Apollo entity, a subgraph needs to expose an entity reference containing a non-resolvable entity with just the @key fields:

type Product @key(fields: "id", resolvable: false) {
  id: ID
}

The ElasticGraph schema would then expose fields like product: Product or products: [Product!]! rather than productId: ID or productIds: [ID!]!. However, if your schema already has a productId field, migrating to the entity reference can be a significant effort, requiring clients to migrate and a backfill.

ElasticGraph v0.19.3.0 includes a new feature to help out in this situation. Here's how to use it:

# Existing field
t.field "productId", "ID"

# New field defined with the new feature
t.apollo_entity_ref_field "product", "Product", id_field_name_in_index: "productId"

This exposes a Product field backed by the productId field.

You can also use this on a collection of IDs:

# Existing field
t.field "productIds", "[ID!]!"

# New field defined with the new feature
t.apollo_entity_ref_field "products", "[Product!]!", id_field_name_in_index: "productIds"

Or, if you want to provide a paginated collection as a relay connection:

# Existing field
t.field "productIds", "[ID!]!"

# New field defined with the new feature
t.apollo_entity_ref_paginated_collection_field "products", "Product", id_field_name_in_index: "productIds"

Upgrade Notes

This release includes a minor breaking change to the custom GraphQL resolver API added in v0.19.2.0. Previously, this was the API to configure a field to use a custom resolver:

schema.on_root_query_type do |t|
  t.field "rollDice", "Int" do |f|
    f.resolver = :roll_dice
  end
end

In ElasticGraph v0.19.3.0, that's changed slightly:

schema.on_root_query_type do |t|
  t.field "rollDice", "Int" do |f|
    f.resolve_with :roll_dice
  end
end

If your project uses custom resolvers (which is not common), you'll need to update to the new API as part of upgrading ElasticGraph.

What's Changed

New Features

Breaking Changes

Bug Fixes

Other Improvements

Full Changelog: v0.19.2.2...v0.19.3.0

v1.0.0.rc1

03 Jun 21:29

Choose a tag to compare

v1.0.0.rc1 Pre-release
Pre-release

What's Changed

Full Changelog: v0.19.2.2...v1.0.0.rc1