Php 不确定我的映射是否在Elasticsearch中起作用
我使用ES与我的Laravel应用程序使用此软件包 在索引数据库之前,我的映射如下所示:Php 不确定我的映射是否在Elasticsearch中起作用,php,mysql,apache,laravel,
elasticsearch,Php,Mysql,Apache,Laravel,
elasticsearch,我使用ES与我的Laravel应用程序使用此软件包 在索引数据库之前,我的映射如下所示: 'ad_title' => [ 'type' => 'string', 'analyzer' => 'standard' ], 'ad_type' => [ 'type' => 'integer', 'index' => 'not_analyze
'ad_title' => [
'type' => 'string',
'analyzer' => 'standard'
],
'ad_type' => [
'type' => 'integer',
'index' => 'not_analyzed'
],
'ad_type' => [
'type' => 'integer',
'index' => 'not_analyzed'
],
'ad_state' => [
'type' => 'integer',
'index' => 'not_analyzed'
],
但是当我进行API调用时(u mapping)?
我的映射如下所示:
"testindex": {
"mappings": {
"ad_ad": {
"properties": {
"ad_city": {
"type": "integer"
},
"ad_id": {
"type": "long"
},
"ad_state": {
"type": "integer"
},
"ad_title": {
"type": "string",
"analyzer": "standard"
},
"ad_type": {
"type": "integer"
},
我是否应该在以后的映射中看到“索引”=>“未分析”?或者,'index'=>“not_analysis'之后是否没有显示在映射结构中?您是正确的,映射没有被应用。如果应用正确,您将在映射API中看到未分析的 确保在写入任何数据之前应用映射。我们在应用程序启动时应用映射,以验证映射始终正确,并应用任何映射更新 以下是如何应用映射的示例:
PUT hilden1
PUT hilden1/type1/_mapping
{
"properties": {
"regular": {
"type": "string"
},
"indexSpecified": {
"type": "string",
"index": "not_analyzed"
}
}
}
要验证映射是否正确,请使用GET api
GET hilden1/type1/_mapping
您应该看到字段“regular”只指定了它的类型,其中as“indexSpecified”列为not_analysis。这是运行ES 1.4.4的机器的输出
{
"hilden1": {
"mappings": {
"type1": {
"properties": {
"indexSpecified": {
"type": "string",
"index": "not_analyzed"
},
"regular": {
"type": "string"
}
}
}
}
}
}
这写在文档的任何地方了吗?我被告知索引:not_analyzed不应该在调用?pretty api时出现。只有analyzer:x应该是可见的。在我上面的例子——“analyzer”中显示了这一点:“standard”GET映射API将向您显示索引或类型的当前映射。漂亮的部分只是格式化json,我不相信它会改变返回内容的结构。好吧,我按照你说的做了。我在日志里什么也看不到。所以不确定为什么“index”=>“not_analysised”不会出现:/I我提供了一些示例代码,您可以在某种意义上使用,希望这有助于澄清。非常感谢!奇怪的是,它不会应用到我的映射中。我也无法在日志中看到错误/警告。我会试着问其他一些人(使用与我相同的软件包)他们是否试图申请非分析型的软件