0

I belive the problem is described in the question itself. I'm making a simple query:

GET /base/products

"body": {
  "query": {
    "filtered": {
        "filter": {
          "and": {
            "filters": [
              {
                "match": {
                  "userId": "10"
                }
              }
            ]
          }
        }
      }
    }
  }
}

But in the responses I get all the items from the database. Actually, I get that number of results provided in the "size" property.

I'm fairly new to elasticsearch so any help is very appreciated!

0

1 Answer 1

2

You need term query, it matches exact value of a field:

{
  "query": {
    "term": {
      "userId": "10" 
    }
  }
}
Sign up to request clarification or add additional context in comments.

1 Comment

In this case, term and match query does not make any difference.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.