Elasticsearch API changes after upgrading to 1.x-three

Source: Internet
Author: User

Please support original: http://www.cnblogs.com/donlianli/p/3841762.html 1. Index format

Prior to 1.x, the document type being indexed will appear in both the URL and the transmitted data format, as follows:

Put/my_index/my_type/1
{
"My_type": {
.... doc Fields ...
}
}

This way is not very good, if a document, itself also has my_type domain, then there will be ambiguity. 1.x version If you encounter the above command, My_type will be treated as a document domain. If you want to use the same as before, you can set the parameter index.mapping.allow_type_wrapper.

2. SearchThe new search interface requires a top-level parameter query in the parameter. Count,delete-by-query and Validate-query These three commands, that query this JSON object is full of queries. The new format is as follows:
GET/_count
{
"Query": {
"Match": {
"title": "Interesting Stuff"
}
}
}

Before 1.x, the filter can also be included under query. Here is the 0.90 version of the query:

GET ' Http://localhost:9200/twitter/tweet/_search?routing=kimchy '-d ' {
"Query": {
"Filtered": {
"Query": {
"Query_string": {
"Query": "Some query string here"
}
},
"Filter": {
"term": {"user": "Kimchy"}
}
}
}
}
'//This format is no longer supported
3. Multi-field search (Multi-fields)
The new format is as follows:
"title": {
' Type ': ' String ',
"Fields": {
"Raw": {"type": "string", "index": "Not_analyzed"}
}
}
4. Stop Word

The new version does not use the English default stop word (the default is no stop word).

5. Date value without year

The new version, which is considered to be 1970 by default when no year is specified (this is the case when indexing and searching).

6. Parameters
    • meters as the default unit for geo-search (miles before 1.x)
    • Min_similarity,fuzziness and edit_distance These parameters are not uniformly modified to fuzziness.
    • The ignore_missing parameter is replaced by Expand_wildcard,ignore_unavailable and Allow_no_indices.
    • In a delete operation, you must specify an index name or a match.
# V0.90-delete All indices:
DELETE/

# V1.0-delete All indices:
DELETE/_all
DELETE/*
7. Return value
    • The OK character in the return value has been removed, and the author considers this additional information meaningless
    • The found,not_found and exists parameters are unified as "found".

Field values, in response fields to the parameter, is now always returned as arrays. A field could has single or multiple values, which meant that sometimes they were returned as scalars and sometimes as AR Rays. By always returning arrays, this simplifies user code. The only exception to this rule was when fields was used to retrieve metadata like routing the value, which be always singular . Metadata fields is always returned as scalars.

fieldsThe parameter is intended to being used for retrieving stored fields, and rather than for fields extracted from the _source . That's means that it can no longer is used to return whole objects and it no longer accepts the _source.fieldname format. For these your should use the and _source _source_include _source_exclude parameters instead.

    • In a parameter query, the returned result is also in JSON format.
    • Analyze related APIs, which are no longer supported directly return text formatting results, only support JSON and YAML format.
8. Unsupported Operation

    • Text query has been removed, use matching query (match search)
    • Domain-oriented search (field query) has been removed, please use query_string instead
    • Document-oriented weighted _boost fields have been removed, use Function_score instead
    • The path parameter is removed, use the copy_to parameter
    • Custom_score and Custom_boost_score are no longer supported, please use Fuction_score instead

About me, Handan people. Weibo: Http://weibo.com/donlianli interested in this kind of topic? Welcome to send mail to [email protected] Please support the original: Http://www.iteye.com/blogs/subjects/elasticsearch-tutor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.