I think that your problem is related this section.
Thanks for an attempt Jun,
I've dug it further and the problem is that I have another mapping type
that also has a timestamp field with type long. However I still did not
succeed reproducing it in a small isolated code.
On Monday, November 18, 2013 9:45:02 AM UTC+2, Jun Ohtani wrote:
Hi,
I try to execute the following gist procedure.
But I have results both your search request: no prefix and exist prefix.
Sorry, I don't know why your query to fail...
I execute "sample_exec.json" step by step. I receive response both requests: no prefix and exists prefix. · GitHub
2013/11/18 Zaar Hai hai...@gmail.com
Thanks Jun,
The output is below. I use dynamic mapping templates heavily since I
have a lot of mapping types.
curl -XGET localhost:9200/restful/events/_mapping?pretty
{
"events" : {
"dynamic_templates" : [ {
"template_string" : {
"mapping" : {
"type" : "multi_field",
"fields" : {
"str" : {
"index_analyzer" : "substrings",
"type" : "string"
},
"{name}" : {
"index_analyzer" : "verbatim",
"type" : "string"
}
}
},
"match" : "",
"match_mapping_type" : "string"
}
}, {
"template_integer" : {
"mapping" : {
"type" : "multi_field",
"fields" : {
"str" : {
"index_analyzer" : "substrings",
"type" : "string"
},
"{name}" : {
"type" : "{dynamic_type}"
}
}
},
"match" : "",
"match_mapping_type" : "integer"
}
}, {
"template_long" : {
"mapping" : {
"type" : "multi_field",
"fields" : {
"str" : {
"index_analyzer" : "substrings",
"type" : "string"
},
"{name}" : {
"type" : "{dynamic_type}"
}
}
},
"match" : "",
"match_mapping_type" : "long"
}
}, {
"template_double" : {
"mapping" : {
"type" : "multi_field",
"fields" : {
"str" : {
"index_analyzer" : "substrings",
"type" : "string"
},
"{name}" : {
"type" : "{dynamic_type}"
}
}
},
"match" : "",
"match_mapping_type" : "double"
}
}, {
"template_date" : {
"mapping" : {
"type" : "multi_field",
"fields" : {
"str" : {
"index_analyzer" : "substrings",
"type" : "string"
},
"{name}" : {
"type" : "{dynamic_type}"
}
}
},
"match" : "",
"match_mapping_type" : "date"
}
}, {
"template_boolean" : {
"mapping" : {
"type" : "multi_field",
"fields" : {
"str" : {
"index_analyzer" : "substrings",
"type" : "string"
},
"{name}" : {
"type" : "{dynamic_type}"
}
}
},
"match" : "",
"match_mapping_type" : "boolean"
}
} ],
"properties" : {
"id" : {
"type" : "multi_field",
"fields" : {
"id" : {
"type" : "long"
},
"str" : {
"type" : "string",
"index_analyzer" : "substrings",
"include_in_all" : false
}
}
},
"timestamp" : {
"type" : "multi_field",
"fields" : {
"timestamp" : {
"type" : "double"
},
"str" : {
"type" : "string",
"index_analyzer" : "substrings",
"include_in_all" : false
}
}
}
}
}
}
On Monday, November 18, 2013 9:05:07 AM UTC+2, Jun Ohtani wrote:
Hi Zaar,
Could you send the following command to ES.
I think that timestamp field is nested.
curl -XGET localhost:9200/restful/events/_mapping?pretty
Regards,
Jun
2013/11/17 Zaar Hai hai...@gmail.com
Hello,
I have index with numerous mapping types. I'm invoking a search with
range query and type restriction like this:
$ curl -XGET http://localhost:9200/restful/_search?pretty -d '{
"query": {"bool": {"must": [{"term": {"_type": "events"}}, {"range": {
"timestamp": {"to": 1383467660, "include_upper": false }}}]}}}'
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
}
It yields zero results although there events with timestamp less then
1383467660. Specifying the field as "events.timestamp". Does the trick :
$ curl -XGET http://localhost:9200/restful/_search?pretty -d '{
"query": {"bool": {"must": [{"term": {"_type": "events"}}, {"range": {
"events.timestamp": {"to": 1383467660, "include_upper": false }}}]}}}'
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.4142135,
"hits" : [ {
"_index" : "restful_copy2",
"_type" : "events",
"_id" : "1",
"_score" : 1.4142135, "_source" : {"timestamp": 1383467425.0,
"id": 1}
} ]
}
}
However I wonder why does it happen? If I use "id" field in range query,
it works both ways. The only difference I can spot that id is of type long
and timestamp is double.
P.S. Elasticsearch 0.90.7.
Thanks,
Zaar
--
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 elasticsearc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
Jun Ohtani
blog : http://blog.johtani.info
--
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 elasticsearc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
Jun Ohtani
blog : http://blog.johtani.info
--
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 elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.