Guest User

Untitled

a guest
Jan 4th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. curl -XDELETE "http://localhost:9200/test"
  2.  
  3. curl -XPUT "http://localhost:9200/test" -H 'Content-Type: application/json' -d'
  4. {
  5. "settings": {
  6. "analysis": {
  7. "normalizer": {
  8. "custom_normalizer": {
  9. "type": "custom",
  10. "char_filter": ["stopword_char_filter", "trim_char_filter"],
  11. "filter": ["lowercase"]
  12. }
  13. },
  14. "char_filter": {
  15. "stopword_char_filter": {
  16. "type": "pattern_replace",
  17. "pattern": "( ?und ?| ?gmbh ?)",
  18. "replacement": " "
  19. },
  20. "trim_char_filter": {
  21. "type": "pattern_replace",
  22. "pattern": "(\s+)$",
  23. "replacement": ""
  24. }
  25. }
  26. }
  27. },
  28. "mappings": {
  29. "file": {
  30. "properties": {
  31. "name": {
  32. "type": "keyword",
  33. "normalizer": "custom_normalizer"
  34. }
  35. }
  36. }
  37. }
  38. }'
  39.  
  40. curl -XPOST "http://localhost:9200/test/_analyze" -H 'Content-Type: application/json' -d'
  41. {
  42. "normalizer": "custom_normalizer",
  43. "text": "hansel und gretel gmbh"
  44. }'
  45.  
  46. curl -XPUT "http://localhost:9200/test/file/1" -H 'Content-Type: application/json' -d'
  47. {
  48. "name": "hansel und gretel gmbh"
  49. }'
  50.  
  51. curl -XGET "http://localhost:9200/test/_search" -H 'Content-Type: application/json' -d'
  52. {
  53. "query": {
  54. "match" : {
  55. "name" : {
  56. "query" : "hansel gretel"
  57. }
  58. }
  59. }
  60. }'
Add Comment
Please, Sign In to add comment