Search code examples
elasticsearchlucenefoselasticabundle

What is the best way to map following unstructured data in elastic search?


I am trying to figure out what could be the best type and anlyzer for a field which has unstructured data.

request field could be of following and many other

  1. {"_format":"json","follow":{"followee":27}} //nested objects
  2. [{"q": "madhab"}] //array of objects
  3. ?q=madhab //string

i have tried making this field text with simple analyzer

"request": {
    "type": "text",
    "analyzer": "simple"
},

Plus: i wonder if there is any online tool which can help to visualize how elastic search tokenize the data with given analyzers, filters


Solution

  • Elastic search gives you an option to see how the text has been tokenized under various analyzers. You can use Kibana or any REST client to see the response for such request:

    GET /_analyze { "analyzer": "standard", "text": "Text to analyze" }

    https://www.elastic.co/guide/en/elasticsearch/guide/master/analysis-intro.html

    This will give you fair idea what is missing in your schema w.r.t your queries.