Exact Match Query on analyzed field

Hi ,

I have an analysed field , it may have different values for each documents. For example ,

doc1 : { "field1" : "abc01 - (http://abc01.com/)" }
doc2 : { "field1" : "abc02 - (http://abc02.com/)" }
doc3 : { "field1" : "-" }

The following is my analysis settings,
index :
analysis :
analyzer :
default_index :
type : custom
tokenizer : whitespace
filter : [ word_delimiter, snowball, lowercase]
default_search :
type : custom
tokenizer : whitespace
filter : [ word_delimiter, snowball, lowercase]
filter :
word_delimiter :
type : word_delimiter
preserve_original : true
split_on_numerics : true
stem_english_possessive : false

I need to filter documents which has only "-" ? i.e.. is it possible query only doc3 (no other terms other than "-")? since doc1 & doc2 also has "-" along with some other terms.

One solution i know is ,
Syntax: boolQuery.must("-") + boolQuery.mustNot("abc*" )
Here too i production mode, i couldn't find all other terms which i need to specify in not query.

just my two cents.

create index

curl -XPUT 'http://localhost:9200/my_index?pretty' -d ' {
    "settings": {
        "number_of_shards": 5,
        "analysis": {
            "analyzer" : {
               "my_analyzer" : {
                    "type" : "custom",
                    "tokenizer" : "whitespace"
               }
            }
        }
    }
}'

create mapping on type and field1

curl -XPUT 'http://localhost:9200/my_index/_mapping/my_type?pretty' -d '
{
    "my_type": {
        "properties": {
            "field1": {
                "type": "string",
                "analyzer": "whitespace"
            }
        }
    }
}'

index sample data

curl -XPOST 'http://localhost:9200/my_index/my_type/_bulk?pretty' -d ' 
{ "index": { "_id": 1 }}
{ "field1": "abc01 - (http://abc01.com/)" }
{ "index": { "_id": 2 }}
{ "field1": "abc02 - (http://abc02.com/)" }
{ "index": { "_id": 3 }}
{ "field1": "-" }
'

query :smile:

curl -XGET 'http://localhost:9200/my_index/_search?pretty' -d '
{
   "query" : {
     "bool" : {
        "must" : {
            "term" : { "field1" : "-" }
        },
        "must_not" : {
            "query_string" : {
                "default_field" : "field1",
                "query" : "abc*"
            }
        }
    }
   }
}'

hth

jason