酒店搜索建议

    1. PUT /hotelsuggest-test2
    2. {
    3. "settings": {
    4. "number_of_shards": 1,
    5. "number_of_replicas": 1,
    6. "analysis": {
    7. "analyzer": {
    8. "ik_and_pinyin_analyzer": {
    9. "type": "custom",
    10. "tokenizer": "ik_smart",
    11. "filter": "my_pinyin"
    12. }
    13. },
    14. "filter": {
    15. "my_pinyin": {
    16. "type": "pinyin",
    17. "keep_first_letter": true,
    18. "keep_full_pinyin": true,
    19. "keep_original": true,
    20. "remove_duplicated_term": true
    21. }
    22. }
    23. }
    24. },
    25. "mappings": {
    26. "properties": {
    27. "hotelName": {
    28. "type": "completion",
    29. "analyzer": "ik_and_pinyin_analyzer"
    30. },
    31. "hotelId": {
    32. "type": "keyword"
    33. }
    34. }
    35. }
    36. }