Elasticsearch

ElasticSearch 検索方法まとめ

More than 5 years have passed since last update.


一般的なテキストサーチ

curl -XPOST "http://localhost:9200/_search" -d'

{
"query": {
"query_string": {
"query": "検索テキスト!"
}
}
}'

公式ドキュメント

Query String Query


インデックス・クエリー

{

"indices" : {
"indices" : ["index1", "index2"],
"query" : {
"term" : { "tag" : "wow" }
},
"no_match_query" : {
"term" : { "tag" : "kow" }
}
}
}

Indices Query


クエリーの形

{

size: # number of results to return (defaults to 10)
from: # offset into results (defaults to 0)
fields: # list of document fields that should be returned - http://elasticsearch.org/guide/reference/api/search/fields.html
sort: # define sort order - see http://elasticsearch.org/guide/reference/api/search/sort.html

query: {
# "query" object following the Query DSL: http://elasticsearch.org/guide/reference/query-dsl/
# details below
},

facets: {
# facets specifications
# Facets provide summary information about a particular field or fields in the data
}

# special case for situations where you want to apply filter/query to results but *not* to facets
filter: {
# filter objects
# a filter is a simple "filter" (query) on a specific field.
# Simple means e.g. checking against a specific value or range of values
}
}


検索用語

ElasticSearch, query, search, text, string, schema, filter

クエリー, サーチ, 検索, テキスト,