Commit acc333bf authored by Sean McGivern's avatar Sean McGivern

Merge branch 'es_filter_scope_for_iid_search' into 'master'

[Elasticsearch] More efficient search

See merge request !1282
parents b705d410 2e83524d
...@@ -141,7 +141,7 @@ module Elastic ...@@ -141,7 +141,7 @@ module Elastic
{ {
query: { query: {
bool: { bool: {
must: [{ term: { iid: iid } }] filter: [{ term: { iid: iid } }]
} }
} }
} }
...@@ -155,7 +155,8 @@ module Elastic ...@@ -155,7 +155,8 @@ module Elastic
options[:public_and_internal_projects] options[:public_and_internal_projects]
) )
query_hash[:query][:bool][:filter] = { query_hash[:query][:bool][:filter] ||= []
query_hash[:query][:bool][:filter] << {
has_parent: { has_parent: {
parent_type: "project", parent_type: "project",
query: { query: {
......
...@@ -79,7 +79,7 @@ module Elastic ...@@ -79,7 +79,7 @@ module Elastic
{ term: { confidential: false } } { term: { confidential: false } }
end end
query_hash[:query][:bool][:must] << filter query_hash[:query][:bool][:filter] << filter
query_hash query_hash
end end
end end
......
---
title: "[Elasticsearch] More efficient search"
merge_request:
author:
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment