1.x之前的版本,被索引的文档type会同时出现在url和传输的数据格式中,如下:
PUT /my_index/my_type/1
{
"my_type": {
... doc fields ...
}
}
这种方式不太妥,如果一个document,本身也有my_type域,那么就会有歧义。1.x版本如果碰到上面的命令,会把my_type当成一个document的域进行处理。如果还想像以前一样使用,可以设置参数index.mapping.allow_type_wrapper.
GET /_count
{
"query":{
"match":{
"title":"Interesting stuff"
}
}
}
1.x之前,query下面还可以包含filter。下面是0.90版的查询:
GET ‘http://localhost:9200/twitter/tweet/_search?routing=kimchy‘-d ‘{
"query":{
"filtered":{
"query":{
"query_string":{
"query":"some query string here"
}
},
"filter":{
"term":{"user":"kimchy"}
}
}
}
}
‘//这种格式不再支持
3、多字段搜索(Multi-fields)
新的格式如下:
"title":{
"type":"string",
"fields":{
"raw": {"type":"string","index":"not_analyzed"}
}
}
4、停止词
新的版本没有使用英语默认的停止词(默认没有停止词)。
5、不带年份的日期值
新的版本,当没有指定是哪一年时,默认认为是1970年(在索引和搜索时都这样对待)。
6、参数
# v0.90 - delete all indices:
DELETE /
# v1.0 - delete all indices:
DELETE /_all
DELETE /*
7、返回值
Field values, in response to the fields
parameter, are now always returned as arrays. A field could have single or multiple values, which meant that sometimes they were returned as scalars and sometimes as arrays. By always returning arrays, this simplifies user code. The only exception to this rule is when fields
is used to retrieve metadata like the routing
value, which are always singular. Metadata fields are always returned as scalars.
The fields
parameter is intended to be used for retrieving stored fields, rather than for fields extracted from the _source
. That means that it can no longer be used to return whole objects and it no longer accepts the _source.fieldname
format. For these you should use the _source
_source_include
and _source_exclude
parameters instead.
Elasticsearch升级至1.x后API的变化-三,布布扣,bubuko.com
原文:http://www.cnblogs.com/donlianli/p/3841762.html