graphql-compose / graphql-compose-elasticsearch

Hide Elastic Search REST API behind GraphQL.
https://graphql-compose.herokuapp.com/elasticsearch/
MIT License
583 stars 77 forks source link

Why field of type array of objects returns first items only #106

Closed appasahebs closed 4 years ago

appasahebs commented 4 years ago

Why field of type array of objects returns first items only.

This is doc... _source:{“terms":{"category":[{"term_id":726,"slug":"a","name":"aa"}, {"term_id":728,"slug":"b","name":"bb"}, {"term_id":729,"slug":"c","name":"cc"}]}}

Result is ... _source:{“terms":{"category":{"term_id":726,"slug":"a","name":"aa"}}}

Not sure why b and c items not been picked. Used same index mapping from elasticsearch

nodkz commented 4 years ago

Try to use

const UserTC = composeWithElastic({
  ...
  pluralFields: ['terms.category'], 
  OR
  pluralFields: ['category'], 
});

I don't remember what exactly will work.

appasahebs commented 4 years ago

Try to use

const UserTC = composeWithElastic({
  ...
  pluralFields: ['terms.category'], 
  OR
  pluralFields: ['category'], 
});

I don't remember what exactly will work.

Awesome, thanks very much! @nodkz