I'm importing data from a mongodb store that uses subdocuments for the _id
field, and I'm having trouble searching against the data that I'm
importing. I've broken down the problem into the following example:
insert 2 documents, one with a complex _id:
curl -XPOST "localhost:9200/index/test" -d '{"key":"value"}'
curl -XPOST "localhost:9200/index/test" -d
'{"_id":{"name":"sfrenkiel"},"key":"value2"}}}'
fetching the first works, of course:
curl "localhost:9200/index/test/_search?pretty=true" -d
'{"query":{"term":{"key":"value"}}}'
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.30685282,
"hits" : [ {
"_index" : "index",
"_type" : "test",
"_id" : "A4AWuBXdQZqLxjxHK_jk9g",
"_score" : 0.30685282, "_source" : {"key":"value"}
} ]
}
}
but fetching the second does not:
curl "localhost:9200/index/test/_search?pretty=true" -d
'{"query":{"term":{"key":"value2"}}}'
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
using the following to discover the list of indexed values reveals that
only the first value has been indexed (if I understand correctly what this
command is doing):
curl -XGET "http://localhost:9200/index/_search?pretty=true" -d '{"query":
{"match_al": {}}, "facets": {"tag": {"terms": {"field": "key"}}}, "size":
0}'
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 1.0,
"hits" : [ ]
},
"facets" : {
"tag" : {
"_type" : "terms",
"missing" : 1,
"total" : 1,
"other" : 0,
"terms" : [ {
"term" : "value",
"count" : 1
} ]
}
}
}
I've tried different mapping strategies and whatever options I can think
of, and nothing seems to work. Strangely, entering the query to fetch the
second record into the head plugin seems to work, but curl (and the java
driver) do not. Can anyone help me out?
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.