lucene - 查询时字段被忽略

标签 lucene elasticsearch

我有以下文件

{ 
  "authors" : "Nanna Friis",
  "authorsId" : [ "4642" ],
  "description" : "Med denne praktiske og pædagogiske håndbog kommer du hele vejen     rundt om at skrive godt til nettet. Du bliver taget ved hånden og får en grundig gennemgang af de helt særlige præmisser, der hersker på nettet. ",
  "iSBN" : "9788762904118",
  "mediaType" : "10",
  "name" : "Kort, klart og klikbart",
  "nameSort" : "Kort, klart og klikbart",
  "price" : 250.0,
  "productId" : "9788762904118",
  "publicationAreaCode" : "3077",
  "tags" : [  ],
  "titleId" : "25004"
}

http://localhost:9200/titles/_search?q=Nanna*这样的查询时,我没有任何结果。如果我改为查询即。像http://localhost:9200/titles/_search?q=9788762904118这样的productId会使文档出现问题。

到底是怎么回事?

最佳答案

您没有在请求中指定查询字段

在这种情况下,您将搜索Default Search Field

When not explicitly specifying the field to search on in the query string syntax, the index.query.default_field will be used to derive which field to search on. It defaults to _all field.

So, if _all field is disabled, it might make sense to change it to set a different default field.

关于lucene - 查询时字段被忽略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15392239/

相关文章:

ElasticSearch:何时使用多字段

ruby-on-rails - Tire-使用条件/自定义_score进行查询

elasticsearch - ElasticSearch按最大日期查询

elasticsearch - 在Macbook上本地运行ElasticSearch

solr - Apache Solr 中的相关反馈

java - Magnolia 6.1.1 分析器(小写字母和重音符号)

Solr 邻近搜索评分

lucene - Solr 关联

amazon-web-services - 如何配置 Winlogbeat 连接到 AWS elasticsearch

java - Lucene 4.0 索引编写器 - 创建单个索引