ElasticSeach映射获取

2024-09-26 17:37:55 发布

您现在位置:Python中文网/ 问答频道 /正文

嗨,我正在尝试通过python弹性搜索来实现映射。我想在代码中添加大小写密集型映射。请检查地图并帮助我。正在获取500传输错误,而不是内容异常。在

    mapping = '''
{
    "settings": {
        "index": {
            "analysis": {
                "analyzer": {
                    "analyzer_keyword": {
                        "tokenizer": "keyword",
                        "filter": "lowercase"
                    }
                }
            }
        }
    },
    "mappings": {
        "countrycpm": {
            "properties": {
                "uid": {
                    "type": "text"
                },
                "country": {
                    "type": "text"
                },
                "cpm": {
                    "type": "float"
                },
                "createdby": {
                    "type": "text"
                },
                "updatedby": {
                    "type": "text"
                },
                "createddate": {
                    "type": "date",
                    "format": "yyyy-MM-dd HH:mm:ss.SSS"
                },
                "updateddate": {
                    "type": "date",
                    "format": "yyyy-MM-dd HH:mm:ss.SSS"
                },
                "status = mode": {
                    "type": "integer"
                },
                "createdbyname": {
                    "type": "text"
                },
                "updatedbyname": {
                    "type": "text"
                }
            }
        }
    }
}
'''

els.indices.put_mapping(index = ES_INDEX, doc_type = 'countrycpm',body=json.dumps(mapping))

回应

^{pr2}$

Tags: textformatdateindexhhtypeanalyzerss

热门问题