Elasticsearch string query char to char

Hi,

I need an index with phash indexed (64 length) and I have to query comparing char to char, for example:

"d1b269d06ec8158d62333679ab6693e6bccd43761692e6c26527dcddd84c8196"

"81b069d20e4154ed7b8371b3aa4596619c6d1ee45856e8174da3cdcdcc6dced3"

I marked as bold the char that are equals in same position (12 in this case). I'd like to query like that and if is possible with a minimal of equals character for match as result.

I tried with fuzzy query but have limit of 2 interpolations as limit.
I tried too with span near query but I haven't any result, maybe something wrong with mapping.

My current mapping is:

{
  "mappings": {
    "properties": {
      "phash": {
        "type": "text",
        "term_vector": "with_positions"
      }
    }
  }
}

And the query that I tried with span near query is:

{
  "query": {
      "filter": [
        {
          "span_near": {
            "clauses": [
              {
                "span_term": {
                  "phash": "d1b269d06ec8158d62333679ab6693e6bccd43761692e6c26527dcddd84c8196"
                }
              }
            ],
            "slop": 60,
            "in_order": false
          }
        }
      ]
  }
}

I use text and term_vector to be able to use span queries. I had keyword before to test fuzzy query.

Any idea or suggest?

Thanks in advance,
Adrian.

Hi,
Any idea about that?

Thanks,
Adrian.

64 fields - one for each char would be manageable.
64 query clauses of the type c1:d OR c2:1 OR c3:b OR c4:2 would also be manageable.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.