Elasticsearch Study Notes (i)

Source: Internet
Author: User

Batch Build Index:

Curl-s-xpost ' Localhost:9200/_bulk '--data-binary @documents. JSON

Paging:

From, size

Back to version:

"Version": True

To limit the result set with a score:

"Min_score": 0.75

Field:* return all fields

_source field:

When requesting a field that is not stored, this field is extracted from the _source field (additional processing is required); Returning the _source field performs better than returning multiple storage fields

Partial fields: (Exclude fields)

"Partial_fields": {"Partial1": {"include": [' titl* '], "exclude": ["chara*"]}}

Script fields:

{"Scirpt_fields": {"correctyear": {"script": "doc[' Year '].value-1800"}}} or "Script": "_source.year-1800" (Save memory, support more complex field values)

Pass parameter to script: "params": {"paramyear": 1800} then "script": "_source.year-paramyear"}

Search Execution Preferences: (Control which shards to execute queries on, such as: _primary, _primary_first, _shards)

Curl-xget ' localhost:9200/library/_search?preference=_local '-D JSON

Search Shard API: (This API allows you to check the shards that will execute the query)

Curl-xget ' Localhost:9200/library/_search_shards?pretty '-D JSON

Weighted query:

"title": {"value": "Crime", "Boost": 10.0}

Multi-entry query:

"Terms": {"title": [' book ', ' novel '], "Minimum_match": 1

Term query does not parse, match query analysis,

Multi_search query: (Query on multiple fields)

Elasticsearch Study Notes (i)

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.