Elasticsearch: Difference between revisions

Jump to navigation Jump to search
497 bytes added ,  15 October 2024
Line 123: Line 123:
== Select particular data from index or table (exact match) ==
== Select particular data from index or table (exact match) ==
Elasticsearch<ref>[https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-index.html Get index API | Elasticsearch Guide [8.15] | Elastic]</ref>
Elasticsearch<ref>[https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-index.html Get index API | Elasticsearch Guide [8.15] | Elastic]</ref>
<pre>
<pre>
GET /MY_INDEX/_search/?q=_id:1
GET /MY_INDEX/_search/?q=_id:1
Line 134: Line 133:
FROM MY_TABLE
FROM MY_TABLE
WHERE id = 1
WHERE id = 1
</pre>
== Select particular data from index or table (partial match) ==
Elasticsearch<ref>[https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html Boolean query | Elasticsearch Guide [8.15] | Elastic]</ref>
<pre>
GET /MY_INDEX/_search
{
  "query": {
    "bool": {
      "should": [
        {
          "match": {
            "field1": "NVIDIA"
          }
        }
      ]
    }
  }
}
</pre>
MySQL
<pre>
SELECT *
FROM MY_TABLE
WHERE field1 LIKE "%NVIDIA%"
</pre>
</pre>


Navigation menu