1 Star 1 Fork 0

宇宙蒙面侠X/github.com-olivere-elastic

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
cluster-test
config
uritemplates
.gitignore
.travis.yml
CHANGELOG-3.0.md
CONTRIBUTING.md
CONTRIBUTORS
LICENSE
README.md
bulk.go
bulk_delete_request.go
bulk_delete_request_test.go
bulk_index_request.go
bulk_index_request_test.go
bulk_request.go
bulk_test.go
bulk_update_request.go
bulk_update_request_test.go
canonicalize.go
canonicalize_test.go
clear_scroll.go
clear_scroll_test.go
client.go
client_test.go
cluster_health.go
cluster_health_test.go
cluster_state.go
cluster_state_test.go
cluster_stats.go
cluster_stats_test.go
connection.go
count.go
count_test.go
decoder.go
decoder_test.go
delete.go
delete_by_query.go
delete_by_query_test.go
delete_template.go
delete_template_test.go
delete_test.go
doc.go
errors.go
errors_test.go
example_test.go
exists.go
exists_test.go
explain.go
explain_test.go
fetch_source_context.go
fetch_source_context_test.go
geo_point.go
geo_point_test.go
get.go
get_mapping.go
get_mapping_test.go
get_template.go
get_template_test.go
get_test.go
highlight.go
highlight_test.go
index.go
index_test.go
indices_close.go
indices_close_test.go
indices_create.go
indices_create_test.go
indices_delete.go
indices_delete_template.go
indices_delete_test.go
indices_exists.go
indices_exists_template.go
indices_exists_template_test.go
indices_exists_test.go
indices_exists_type.go
indices_exists_type_test.go
indices_flush.go
indices_flush_test.go
indices_get.go
indices_get_aliases.go
indices_get_aliases_test.go
indices_get_settings.go
indices_get_settings_test.go
indices_get_template.go
indices_get_template_test.go
indices_get_test.go
indices_open.go
indices_open_test.go
indices_put_alias.go
indices_put_alias_test.go
indices_put_mapping.go
indices_put_mapping_test.go
indices_put_template.go
indices_refresh.go
indices_refresh_test.go
indices_stats.go
indices_stats_test.go
inner_hit.go
inner_hit_test.go
mget.go
mget_test.go
msearch.go
msearch_test.go
nodes_info.go
nodes_info_test.go
optimize.go
optimize_test.go
percolate.go
percolate_test.go
ping.go
ping_test.go
plugins.go
plugins_test.go
query.go
reindexer.go
reindexer_test.go
request.go
rescore.go
rescorer.go
response.go
scan.go
scan_test.go
script.go
script_test.go
scroll.go
scroll_test.go
search.go
search_aggs.go
search_aggs_bucket_children.go
search_aggs_bucket_children_test.go
search_aggs_bucket_date_histogram.go
search_aggs_bucket_date_histogram_test.go
search_aggs_bucket_date_range.go
search_aggs_bucket_date_range_test.go
search_aggs_bucket_filter.go
search_aggs_bucket_filter_test.go
search_aggs_bucket_filters.go
search_aggs_bucket_filters_test.go
search_aggs_bucket_geo_distance.go
search_aggs_bucket_geo_distance_test.go
search_aggs_bucket_global.go
search_aggs_bucket_global_test.go
search_aggs_bucket_histogram.go
search_aggs_bucket_histogram_test.go
search_aggs_bucket_missing.go
search_aggs_bucket_missing_test.go
search_aggs_bucket_nested.go
search_aggs_bucket_nested_test.go
search_aggs_bucket_range.go
search_aggs_bucket_range_test.go
search_aggs_bucket_significant_terms.go
search_aggs_bucket_significant_terms_test.go
search_aggs_bucket_terms.go
search_aggs_bucket_terms_test.go
search_aggs_metrics_avg.go
search_aggs_metrics_avg_test.go
search_aggs_metrics_cardinality.go
search_aggs_metrics_cardinality_test.go
search_aggs_metrics_extended_stats.go
search_aggs_metrics_extended_stats_test.go
search_aggs_metrics_geo_bounds.go
search_aggs_metrics_geo_bounds_test.go
search_aggs_metrics_max.go
search_aggs_metrics_max_test.go
search_aggs_metrics_min.go
search_aggs_metrics_min_test.go
search_aggs_metrics_percentile_ranks.go
search_aggs_metrics_percentile_ranks_test.go
search_aggs_metrics_percentiles.go
search_aggs_metrics_percentiles_test.go
search_aggs_metrics_stats.go
search_aggs_metrics_stats_test.go
search_aggs_metrics_sum.go
search_aggs_metrics_sum_test.go
search_aggs_metrics_top_hits.go
search_aggs_metrics_top_hits_test.go
search_aggs_metrics_value_count.go
search_aggs_metrics_value_count_test.go
search_aggs_pipeline_avg_bucket.go
search_aggs_pipeline_avg_bucket_test.go
search_aggs_pipeline_bucket_script.go
search_aggs_pipeline_bucket_script_test.go
search_aggs_pipeline_bucket_selector.go
search_aggs_pipeline_bucket_selector_test.go
search_aggs_pipeline_cumulative_sum.go
search_aggs_pipeline_cumulative_sum_test.go
search_aggs_pipeline_derivative.go
search_aggs_pipeline_derivative_test.go
search_aggs_pipeline_max_bucket.go
search_aggs_pipeline_max_bucket_test.go
search_aggs_pipeline_min_bucket.go
search_aggs_pipeline_min_bucket_test.go
search_aggs_pipeline_mov_avg.go
search_aggs_pipeline_mov_avg_test.go
search_aggs_pipeline_serial_diff.go
search_aggs_pipeline_serial_diff_test.go
search_aggs_pipeline_sum_bucket.go
search_aggs_pipeline_sum_bucket_test.go
search_aggs_pipeline_test.go
search_aggs_test.go
search_queries_bool.go
search_queries_bool_test.go
search_queries_boosting.go
search_queries_boosting_test.go
search_queries_common_terms.go
search_queries_common_terms_test.go
search_queries_constant_score.go
search_queries_constant_score_test.go
search_queries_dis_max.go
search_queries_dis_max_test.go
search_queries_exists.go
search_queries_exists_test.go
search_queries_fsq.go
search_queries_fsq_score_funcs.go
search_queries_fsq_test.go
search_queries_fuzzy.go
search_queries_fuzzy_test.go
search_queries_geo_bounding_box.go
search_queries_geo_bounding_box_test.go
search_queries_geo_distance.go
search_queries_geo_distance_test.go
search_queries_geo_polygon.go
search_queries_geo_polygon_test.go
search_queries_has_child.go
search_queries_has_child_test.go
search_queries_has_parent.go
search_queries_has_parent_test.go
search_queries_ids.go
search_queries_ids_test.go
search_queries_indices.go
search_queries_indices_test.go
search_queries_match.go
search_queries_match_all.go
search_queries_match_all_test.go
search_queries_match_test.go
search_queries_missing.go
search_queries_missing_test.go
search_queries_more_like_this.go
search_queries_more_like_this_test.go
search_queries_multi_match.go
search_queries_multi_match_test.go
search_queries_nested.go
search_queries_nested_test.go
search_queries_not.go
search_queries_not_test.go
search_queries_prefix.go
search_queries_prefix_test.go
search_queries_query_string.go
search_queries_query_string_test.go
search_queries_range.go
search_queries_range_test.go
search_queries_regexp.go
search_queries_regexp_test.go
search_queries_script.go
search_queries_script_test.go
search_queries_simple_query_string.go
search_queries_simple_query_string_test.go
search_queries_template_query.go
search_queries_template_query_test.go
search_queries_term.go
search_queries_term_test.go
search_queries_terms.go
search_queries_terms_test.go
search_queries_type.go
search_queries_type_test.go
search_queries_wildcard.go
search_queries_wildcard_test.go
search_request.go
search_request_test.go
search_source.go
search_source_test.go
search_suggester_test.go
search_template.go
search_templates_test.go
search_test.go
setup_test.go
sort.go
sort_test.go
suggest.go
suggest_field.go
suggest_field_test.go
suggest_test.go
suggester.go
suggester_completion.go
suggester_completion_fuzzy.go
suggester_completion_fuzzy_test.go
suggester_completion_test.go
suggester_context.go
suggester_context_category.go
suggester_context_category_test.go
suggester_context_geo.go
suggester_context_geo_test.go
suggester_phrase.go
suggester_phrase_test.go
suggester_term.go
suggester_term_test.go
update.go
update_test.go
克隆/下载
search_queries_exists.go 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
// Copyright 2012-2015 Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
// ExistsQuery is a query that only matches on documents that the field
// has a value in them.
//
// For more details, see:
// https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html
type ExistsQuery struct {
name string
queryName string
}
// NewExistsQuery creates and initializes a new dis max query.
func NewExistsQuery(name string) *ExistsQuery {
return &ExistsQuery{
name: name,
}
}
// QueryName sets the query name for the filter that can be used
// when searching for matched queries per hit.
func (q *ExistsQuery) QueryName(queryName string) *ExistsQuery {
q.queryName = queryName
return q
}
// Source returns the JSON serializable content for this query.
func (q *ExistsQuery) Source() (interface{}, error) {
// {
// "exists" : {
// "field" : "user"
// }
// }
query := make(map[string]interface{})
params := make(map[string]interface{})
query["exists"] = params
params["field"] = q.name
if q.queryName != "" {
params["_name"] = q.queryName
}
return query, nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/awol2010ex/github.com-olivere-elastic.git
git@gitee.com:awol2010ex/github.com-olivere-elastic.git
awol2010ex
github.com-olivere-elastic
github.com-olivere-elastic
v3.0.7

搜索帮助

0d507c66 1850385 C8b1a773 1850385