简体   繁体   中英

Elasticsearch lucene query

I am searching on an element called package, which has the field pkg_scope.

When I add the following string to my query I get 200 results:

AND ( pkg_scope:'Scope Undefined')

When I add the following string instead, I get one result:

AND ( NOT pkg_scope:'Top File')

The one result has a scope 'Scope Undefined'. I think it is reasonable to expect that the second query results would contain the results of the first one. Am I missing something ?

This is the complete query:

 query: *:* AND rectype:'Package' AND isPublic:"Yes" AND ( NOT pkg_scope:'Top File'  )

I am using ES 1.7.1

The problem was the quotes around the string. For more than one words, double quotes need to be used. So NOT pkg_scope:'Top File' need to be changed to NOT pkg_scope:"Top File"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM