[英]ElasticSearch Mapping Non Searchable Field
Im new to elastic search. 我是弹性搜索的新手。
In my users
type in profiles
index i have fields 在我的users
输入profiles
索引,我有字段
properties : {
name : {type : string},
picture : {
url_small : {}
url_big : {}
}
}
In this index picture
is just for storing/getting data and will never be used in doing any query but only will be retrieved with matched hits. 在此索引中, picture
仅用于存储/获取数据,将永远不会用于执行任何查询,而只会通过匹配的匹配项进行检索。
So how to create the mapping of picture
? 那么如何创建picture
映射呢? What type
, analyzer
,fields should i use ? 我应该使用哪种type
analyzer
,字段?
You are dealing with two things here: 您在这里处理两件事:
To define how the data will be stored, you use type
. 要定义数据的存储方式,请使用type
。
To define how the data will be indexed (directly, after being analyzed, or, in your case, not indexed), you use index
. 要定义如何对数据建立索引(在分析后直接建立索引,或者在您的情况下不建立索引),请使用index
。
And if you want to define how the data is analyzed for the indexing, you have to use analyzer
. 如果要定义如何分析数据以建立索引,则必须使用analyzer
。
You want to store string, but not to index them, so you use: 您想存储字符串,但不想为其编制索引,因此可以使用:
{
type: string,
index: no
}
Which gives you: 这给你:
properties : {
name : {"type": "string"},
picture : {
url_small : {
"type": "string",
"index": "no"
},
url_big : {
"type": "string",
"index": "no"
}
}
}
https://www.elastic.co/guide/en/elasticsearch/reference/2.4/mapping-index.html https://www.elastic.co/guide/en/elasticsearch/reference/2.4/mapping-index.html
Hope it's clear 希望很清楚
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.