Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use whitelist #77

Closed
EliSadaka opened this issue Apr 24, 2019 · 2 comments
Closed

How to use whitelist #77

EliSadaka opened this issue Apr 24, 2019 · 2 comments

Comments

@EliSadaka
Copy link

The latest update implemented whitelisting query parameters but the docs do not show how to use this option. I tried doing this but it didn't seem to work:

const postsElasticService = elasticService({
    Model: new elasticsearch.Client({
      host: process.env.ELASTICSEARCH_URL,
      apiVersion: '6.3',
    }),
    paginate: {
      default: 10,
      max: 50
    },
    elasticsearch: {
      index: 'posts',
      type: 'post'
    },
    whitelist: ['$phrase_prefix'],
    esVersion: '6.3'
  });
@jciolek
Copy link
Collaborator

jciolek commented Apr 25, 2019

Hey @EliSadaka,

Thanks for using Feathers and feathers-elasticsearch!

$phrase_prefix is whitelisted in the service by default:
https://github.com/feathersjs-ecosystem/feathers-elasticsearch/blob/master/lib/index.js#L29

The option you are passing should override the default whitelist, which would block other ES specific queries. Is that what is happening?

Thanks for pointing out the omission in the doc, good spot! I believed I missed it, because the whitelist is a standard Feathers service thing now (https://docs.feathersjs.com/api/databases/common.html#serviceoptions). I'll add it for completeness.

@EliSadaka
Copy link
Author

Yes, I believe that's what was causing my issue. It works without overriding the whitelist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants