V
V
Vlad Timofeev2015-01-22 23:09:49
JavaScript
Vlad Timofeev, 2015-01-22 23:09:49

How to make an additional validation field in mongoosastic?

Of course, I'm sorry :D I'm going to be the most fludder of the DB category today ))
But .. How can I add a check in mongoosastic that the post has an access : true field?

Post.search({
  query_string: {query: req.params.q}},
    {
      from: (curPage - 1) * perPage,
      size: perPage,
      sort: 'num:desc',},
   function(err, results) {
...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MintTea, 2015-01-22
@PyTiMa

Filtered query , Term filter
I think so:

Post.search(
    {
        filtered: {
            query: {
                query_string: {
                    query: req.params.q
                }
            },
            filter: {
                term: {
                    access: true
                }
            }
        }
    },
    {
      from: (curPage - 1) * perPage,
      size: perPage,
      sort: 'num:desc'
    },
    function(err, results) {
    }
)

You still try to read the docs on dsl elastic;)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question