Dear all,
I am a complete newbie, so I am sorry if this is a trivial question.
The question is: why does the 'exists' query (see below) not work??
I did do a search and read the documentation and I have the idea that I am overlooking something quite simple, but I just don't seem to see what it is...
What I do is this:
-
I make a new column in an existing index (where the type is 'article'):
$ curl -XPUT http://myElasticSearchUrl:9280/myIndex/article/_mapping -d '{
"article" : {
"properties" : {
"myMFCol" : {
"type": "multi_field",
"fields" : { "myField1" : { "type": "string",
"index" : "analyzed"},
"myField2" : { "type": "string",
"index" : "analyzed"}
}
}
}
}
}' -
I add a document, with the new field
$ curl -XPUT http://myElasticSearchUrl:9280/myIndex/article/myMFId1 -d '{
"articleurl": "http://www.blabla.nl",
"text": "Bla bla"s bla bla",
"myMFCol" : {"myField1": "Check value 1",
"myField2" : "Check value 2" }
}' -
Check that it worked:
$ curl -XGET http://myElasticSearchUrl:9280/myIndex/article/myMFId1
{"_index":"myIndex","_type":"article","_id":"myMFId1","_version":2,"exists":true, "_source" : {
"articleurl": "http://www.blabla.nl",
"text": "Bla bla"s bla bla",
"myMFCol" : {"myField1": "Check value 1",
"myField2" : "Check value 2" }
}} -
Then I tty to get all documents that have this field
$ curl -XGET http://myElasticSearchUrl:9280/myIndex/article/_search -d '{ "filter" : { "exists" : {"field" : "myMFCol" } }
{"took":14,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}
?!?
So I would expect to get this 1 document here, but I get none.
Why not?
Any help appreciated!
Cheers,
Tom