をフィールドを除外:は、以下のマッピング持つElasticsearchクエリに
curl -XPUT 'localhost:9200/testidx?pretty=true' -d '{
"mappings": {
"items": {
"dynamic": "strict",
"properties" : {
"title" : { "type": "string" },
"body" : { "type": "string" }
}}}}'
を私は上の2つのアイテムを置く:
curl -XPUT 'localhost:9200/testidx/items/1' -d '{
"title": "Titulo anterior",
"body": "blablabla blablabla blablabla blablabla blablabla blablabla"
}'
curl -XPUT 'localhost:9200/testidx/items/2' -d '{
"title": "Joselr",
"body": "Titulo stuff more stuff"
}'
は今、私はすべてのフィールドに単語titulo
を検索したいけどbody
、私は何をしているのですか(this投稿に続く):
curl -XGET 'localhost:9200/testidx/items/_search?pretty=true' -d '{
"query" : {
"query_string": {
"query": "Titulo"
}},
"_source" : {
"exclude" : ["*.body"]
}
}'
これは、第2のものはTitulo
という単語を持っていますが、それはbody
にあり、それは無視したいものですから、1
アイテムだけを表示するはずです。これをどのようにアーカイブできますか?
PS:これは単なる簡単な例ですが、多くのプロパティを使ったマッピングがあり、いくつかの検索ではその一部を無視したいと思います。
PS2:私はES 2.3.2
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-source-filtering.html&rqid=iKqKTO4D&geid=lo – blackmamba
これは私が試みたものです。私の質問をまず読んでください。 –