简体   繁体   English

如何在simple_query_string中使用“ *”获取elasticsearch索引中的所有文档

[英]How to get all documents in elasticsearch index using “*” in simple_query_string

I am passing the * into the query to fetch all fields in index using the simple_query_string script, but it returns only an empty result. 我将*传递到查询中,以使用simple_query_string脚本获取索引中的所有字段,但它仅返回空结果。 Kindly guide me to solve this situation. 请指导我解决这种情况。 The formed query is: 形成的查询为:

{"query":{"simple_query_string":{"query":"*","fields":["_all"]}},"from":0,"size":5} { “查询”:{ “simple_query_string”:{ “查询”: “*”, “田”:[ “_所有”]}} “从”:0, “大小”:5}

The answer to your question is found in the docs : 您的问题的答案在docs中找到:

* at the end of a term signifies a prefix query 字词末的*表示前缀查询

* is not a regular wildcard. *不是常规的通配符。 You can only use it at the end of a token, eg exampl* matches exampleword 您只能在令牌末尾使用它,例如, exampleword exampl*exampleword匹配

If you want to get all available documents there's a dedicated query for that : 如果您想获取所有可用的文档,可以使用专门的查询

{ "match_all": {} } {“ match_all”:{}}

For wildcard style match you would use : 对于通配符样式匹配,您可以使用:

{ "wildcard" : { "user" : "ki*y" } } {“通配符”:{“用户”:“ ki * y”}}

Check more info on wildcard queries here . 此处检查有关通配符查询的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Elasticsearch-Java RestHighLevelClient-如何使用滚动API获取所有文档 - Elasticsearch - Java RestHighLevelClient - how to get all documents using scroll api 如何获取lucene索引的所有文件? - How to get all documents of lucene index? 如何使用Java程序在Elasticsearch集群上执行简单的索引,更新,获取和删除操作 - How to perform simple index,update,get and delete operation on a elasticsearch cluster using java program Elasticsearch从所有文档中获取字段的值 - Elasticsearch Get the values of a field from all the documents 使用Spring MongoOperations获取基于查询的所有文档 - Get all documents based on query using Spring MongoOperations 删除所有文档而不删除 elasticsearch java API 中的索引 - deleting all documents with out dropping index in elasticsearch java API 如何使用java API在现有的elasticsearch索引中添加更多文档? - How to add more documents in already existing elasticsearch index using java API? 如何从其他文档(ElasticSearch)中按字段值获取嵌套文档? - How to get nested documents by field value from other documents (ElasticSearch)? 如何使用Elasticsearch Java Api使用query_string创建查询 - How to create a query with query_string using Elasticsearch Java Api Elasticsearch Java API - 如何在不检索文档的情况下获取文档数量 - Elasticsearch Java API - How to get the number of documents without retrieving the documents
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM